예제 #1
0
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"])
예제 #2
0
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)
예제 #3
0
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))
예제 #4
0
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")
예제 #5
0
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)
예제 #6
0
    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))
예제 #7
0
def start(message):
    bot.send_message(message.chat.id, f'Hello, {message.from_user.first_name}\n', reply_markup=main_keyboard_markup)
예제 #8
0
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")
예제 #9
0
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 :)')
예제 #10
0
def return_to_main_menu(message):
    bot.send_message(message.chat.id,
                     'Main menu:',
                     reply_markup=main_keyboard_markup)
예제 #11
0
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)
예제 #12
0
def start(message):
    bot.send_message(message.chat.id,
                     'Your cabinet:',
                     reply_markup=cabinet_keyboard_markup)