def start_gm_mode(bot: telegram.Bot, message: telegram.Message, chat: Chat): _ = partial(get_by_user, user=message.from_user) if chat.gm_mode: return chat.gm_mode = True chat.save() sent = bot.send_message(chat.chat_id, _(Text.START_GM_MODE), parse_mode='HTML') chat.gm_mode_notice = sent.message_id chat.save()
def finish_gm_mode(message: telegram.Message, chat: Chat): _ = partial(get_by_user, user=message.from_user) if chat.gm_mode: if chat.gm_mode_notice: delete_message(chat.chat_id, chat.gm_mode_notice, 20) chat.gm_mode = False chat.gm_mode_notice = None chat.save() send_message(chat.chat_id, _(Text.FINISH_GM_MODE), delete_after=20) delete_message(message.chat_id, message.message_id)