예제 #1
0
파일: help.py 프로젝트: hobbit19/Nana-Bot
async def help_parser(client, chat_id, text, keyboard=None):
    if not keyboard:
        keyboard = InlineKeyboardMarkup(paginate_modules(0, HELP_COMMANDS, "help"))
    if NANA_IMG:
        await client.send_photo(chat_id, NANA_IMG, caption=text, reply_markup=keyboard)
    else:
        await client.send_message(chat_id, text, reply_markup=keyboard)
예제 #2
0
파일: help.py 프로젝트: Reyatsu99/Nana-Bot
async def help_button(_client, query):
    mod_match = re.match(r"help_module\((.+?)\)", query.data)
    prev_match = re.match(r"help_prev\((.+?)\)", query.data)
    next_match = re.match(r"help_next\((.+?)\)", query.data)
    back_match = re.match(r"help_back", query.data)
    if True:
        if mod_match:
            module = mod_match.group(1)
            text = "This is help for the module **{}**:\n".format(HELP_COMMANDS[module].__MODULE__) \
                   + HELP_COMMANDS[module].__HELP__

            await query.message.edit(text=text,
                                     reply_markup=InlineKeyboardMarkup([[
                                         InlineKeyboardButton(
                                             text="⬅️ Back",
                                             callback_data="help_back")
                                     ]]))

        elif prev_match:
            curr_page = int(prev_match.group(1))
            await query.message.edit_text(text=HELP_STRINGS,
                                          reply_markup=InlineKeyboardMarkup(
                                              paginate_modules(
                                                  curr_page - 1, HELP_COMMANDS,
                                                  "help")))

        elif next_match:
            next_page = int(next_match.group(1))
            await query.message.edit(text=HELP_STRINGS,
                                     reply_markup=InlineKeyboardMarkup(
                                         paginate_modules(
                                             next_page + 1, HELP_COMMANDS,
                                             "help")))

        elif back_match:
            await query.message.edit(text=HELP_STRINGS,
                                     reply_markup=InlineKeyboardMarkup(
                                         paginate_modules(
                                             0, HELP_COMMANDS, "help")))
예제 #3
0
파일: help.py 프로젝트: OTaKuHP/Nana-Remix
async def help_button(_client, query):
    mod_match = re.match(r"help_module\((.+?)\)", query.data)
    back_match = re.match(r"help_back", query.data)
    if mod_match:
        module = mod_match.group(1)
        text = "This is help for the module **{}**:\n".format(HELP_COMMANDS[module].__MODULE__) \
               + HELP_COMMANDS[module].__HELP__

        await query.message.edit(text=text,
                                 reply_markup=InlineKeyboardMarkup([[
                                     InlineKeyboardButton(
                                         text="Back",
                                         callback_data="help_back")
                                 ]]))

    elif back_match:
        await query.message.edit(
            text=tld("help_str").format(", ".join(Command)),
            reply_markup=InlineKeyboardMarkup(
                paginate_modules(0, HELP_COMMANDS, "help")))
예제 #4
0
파일: help.py 프로젝트: Reyatsu99/Nana-Bot
async def help_parser(client, chat_id, text, keyboard=None):
    if not keyboard:
        keyboard = InlineKeyboardMarkup(
            paginate_modules(0, HELP_COMMANDS, "help"))
    await client.send_message(chat_id, text, reply_markup=keyboard)