|
|
@ -35,9 +35,6 @@ class Bot(telebot.TeleBot): |
|
|
|
for template_file in config.get('template_files', []): |
|
|
|
for template_file in config.get('template_files', []): |
|
|
|
self.templates.load_file(template_file) |
|
|
|
self.templates.load_file(template_file) |
|
|
|
self.main_keyboard = None |
|
|
|
self.main_keyboard = None |
|
|
|
if config.get('main_keyboard') is not None: |
|
|
|
|
|
|
|
kb = config.get('main_keyboard') |
|
|
|
|
|
|
|
self.main_keyboard = {key: utils.create_keyboard(kb[key]) for key in kb.keys()} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_template(self, template_name: str, locale: str = 'ru', **kwargs) -> \ |
|
|
|
def render_template(self, template_name: str, locale: str = 'ru', **kwargs) -> \ |
|
|
|
typing.Tuple[str, typing.Union[telebot.types.ReplyKeyboardMarkup, telebot.types.InlineKeyboardMarkup]]: |
|
|
|
typing.Tuple[str, typing.Union[telebot.types.ReplyKeyboardMarkup, telebot.types.InlineKeyboardMarkup]]: |
|
|
@ -120,7 +117,6 @@ class Bot(telebot.TeleBot): |
|
|
|
self.db.users.replace_one({'user_id': user.user_id}, user.dict()) |
|
|
|
self.db.users.replace_one({'user_id': user.user_id}, user.dict()) |
|
|
|
|
|
|
|
|
|
|
|
def save_community(self, community: Community): |
|
|
|
def save_community(self, community: Community): |
|
|
|
print(community.dict()) |
|
|
|
|
|
|
|
self.db.communities.replace_one({'chat_id': community.chat_id}, community.dict()) |
|
|
|
self.db.communities.replace_one({'chat_id': community.chat_id}, community.dict()) |
|
|
|
|
|
|
|
|
|
|
|
def handle_commands(self, cmds: typing.List[str]): |
|
|
|
def handle_commands(self, cmds: typing.List[str]): |
|
|
@ -209,6 +205,11 @@ class Bot(telebot.TeleBot): |
|
|
|
self.send_template(meeting[0], 'meeting_info', community=community, meeting=meeting, person=person_2) |
|
|
|
self.send_template(meeting[0], 'meeting_info', community=community, meeting=meeting, person=person_2) |
|
|
|
self.send_template(meeting[1], 'meeting_info', community=community, meeting=meeting, person=person_1) |
|
|
|
self.send_template(meeting[1], 'meeting_info', community=community, meeting=meeting, person=person_1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def community_post_edit_routine(self, community: Community): |
|
|
|
|
|
|
|
community.schedule_meetings() |
|
|
|
|
|
|
|
self.send_meeting_info_in_community(community) |
|
|
|
|
|
|
|
self.save_community(community) |
|
|
|
|
|
|
|
|
|
|
|
def register_next_step_handler(self, message, callback, *args, **kwargs): |
|
|
|
def register_next_step_handler(self, message, callback, *args, **kwargs): |
|
|
|
if isinstance(message, telebot.types.CallbackQuery): |
|
|
|
if isinstance(message, telebot.types.CallbackQuery): |
|
|
|
message = message.message |
|
|
|
message = message.message |
|
|
|