コード例 #1
0
def send_pubg_request(message):
    if message.chat.type == "private":
        return

    chat_id = message.chat.id
    active_poll = config.press_button.pop(chat_id, None)

    if active_poll:
        bot.delete_message(chat_id, active_poll.get("message"))

    title = (translate(config.pubg_mess) if message.from_user.username
             in config.users else config.pubg_mess)

    mess = bot.send_message(chat_id, title, reply_markup=get_markup_pubg())

    config.press_button[chat_id] = {"message": mess.message_id, "users": []}
コード例 #2
0
def pubg_poll_call(call):
    chat_id = call.message.chat.id
    is_exists, is_all = check_press_button_user(call)

    if not is_exists:
        bot.delete_message(chat_id, config.press_button[chat_id]['message'])
        mess = bot.send_message(
            chat_id,
            update_text(call),
            reply_markup=None if is_all else get_markup_pubg(),
        )
        config.press_button[chat_id]['message'] = mess.message_id

    if is_all:
        config.press_button.pop(chat_id)

    bot.answer_callback_query(call.id, text="")