-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseting.py
69 lines (57 loc) · 2 KB
/
seting.py
1
from telebot import typesimport datetimefrom users import Userclass Settings: def __init__(self): self.many_can_link: int = 1 self.time_reg: int = 30 self.start_keyboard = types.InlineKeyboardMarkup(row_width=1).add( types.InlineKeyboardButton(text="зарегистрироваться", callback_data="registration") ) self.start_keyboard_y_reg = types.InlineKeyboardMarkup(row_width=1) self.start_text = "Hello" self.number_in_stage: int = 0 self.many_can: int = 0 def set_many_can_link(self, value: int): self.time_reg = value def set_time_reg(self, value: int): self.time_reg = value def app_start_keyboard(self, text: str, url: str): self.start_keyboard.add( types.InlineKeyboardButton( text=text, url=url ) ) self.start_keyboard_y_reg.add( types.InlineKeyboardButton( text=text, url=url ) ) def del_butt(self, text: str) -> bool: ind = -1 for but in self.start_keyboard.keyboard: ind += 1 if but[0].text == text: if ind == 0: return True del self.start_keyboard.keyboard[ind] del self.start_keyboard_y_reg.keyboard[ind - 1] return False else: return True def check_place(self) -> bool: if self.number_in_stage < self.many_can: return True else: return False def check_time(self, data: dict[int, User]) -> bool: for i in data: user = data[i] if datetime.datetime.now() - user.time_start > self.time_reg: ### test if user.status_registration = True ###нужно менять его сообщение и убирать флаг на прием return True else: return False