def test_callback(call): # check if user is already signed for this or any game game_id = call.data.split("_")[-1] try: bot.send_message(call.from_user.id, text=accept_game(game_id), reply_markup=accept_invitation_keyboard(game_id)) except: bot.send_message(call.message.chat.id, f"{call.from_user.username}" + warnings["user_not_authorized"])
def create_description(message): message.db_user.tmp_room.description = message.text print(message.db_user.tmp_room) RoomRepository.insert(message.db_user.tmp_room) UserRepository.set_state(message.db_user.id, CommonBotState.DEFAULT_STATE) bot.send_message(message.chat.id, f'Saved room:\n, {message.db_user.tmp_room.id}\n', reply_markup=main_keyboard_markup)
def return_to_room(message): rooms_dict = RoomRepository.get_all_ids_by_user_id(message.db_user.id) bot.send_message(message.chat.id, 'Your Rooms:', reply_markup=return_to_main_menu_keyboard_markup) for room_name in rooms_dict: tmp_room = RoomRepository.get_by_id(room_name) bot.send_message( message.chat.id, f'Room:\nName: [{room_name}]\nDescription: [{tmp_room.description}]', reply_markup=room_details_cb(room_name))
def accept_game_func(call): # print(call) game_id = call.data.split("_")[-1] # change it for try/except with manual exceptions game = dbController.game_add_player(game_id, call.from_user.id) if game: bot.send_message(call.from_user.id, game_accepted(game_id)) update_main_message(bot, game) else: # get it to warnings bot.send_message(call.from_user.id, "error")
def create_game(message): if message.db_user.curr_game: bot.reply_to(message, warnings["cant_create_game"]) return # notify_admin_chat(bot, f"User @{message.from_user.username} created new game") game_main_message = bot.send_message(message.chat.id, f"Creating game ...") new_game = dbController.create_game(message.db_user, message.chat.id, game_main_message.message_id) update_main_message(bot, new_game)
async def check_changes(res: dict): """Вывод информации о статусе фирмы""" data = res.get('vyp') name_firm = data.get('НаимЮЛПолн') print(name_firm) inn = data.get('ИНН') if 'СвНедАдресЮЛ' in data: info = data.get('СвНедАдресЮЛ')[0] mes = f'Название:{name_firm}\nИНН:{inn}\n\tТекст:<b>СВЕДЕНИЯ О НЕДОСТОВЕРНОСТИ ДАННЫХ ОБ АДРЕСЕ </b>' # print(mes) # await shield(bot.send_message(chat_id=589574396, text=mes)) await shield(bot.send_message(chat_id=-1001457324002, text=mes)) elif 'СведДолжнФЛ' in data: info = data.get('СведДолжнФЛ')[0] sugn = info.get('СвНедДанДолжнФЛ')[0] mes = f'Название:{name_firm}\nИНН:{inn}\n\tТекст:<b>СВЕДЕНИЯ О НЕДОСТОВЕРНОСТИ ДАННЫХ О РУКОВОДИТЕЛЕ ' \ f'КОМПАНИИ</b>\n\t{sugn.get("ТекстНедДанДолжнФЛ")}\n\tДата записи:{sugn.get("ДатаЗаписи")}' # print(mes) # await shield(bot.send_message(chat_id=589574396, text=mes)) await shield(bot.send_message(chat_id=-1001457324002, text=mes))
def start(message): bot.send_message(message.chat.id, f'Hello, {message.from_user.first_name}\n', reply_markup=main_keyboard_markup)
def game_info(message): game = message.db_user.curr_game if not game: bot.reply_to(message, no_game_info_text()) return bot.send_message(message.chat.id, game_info_text(game), parse_mode="HTML")
def rooms_details(call): room_id = get_call_parameters(call.data, InlineKeyboardsType.ROOMS_DETAILS)[0] room = RoomRepository.get_by_id(room_id) bot.send_message(call.message.chat.id, 'ROOM INFO HERE :)')
def return_to_main_menu(message): bot.send_message(message.chat.id, 'Main menu:', reply_markup=main_keyboard_markup)
def create_new_room(message): UserRepository.set_state(message.db_user.id, CreateRoomBotState.GET_ROOM_NAME) bot.send_message(message.chat.id, 'New room:', reply_markup=remove_keyboard)
def start(message): bot.send_message(message.chat.id, 'Your cabinet:', reply_markup=cabinet_keyboard_markup)