async def help_button(_, 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_PREFIXES)), reply_markup=InlineKeyboardMarkup( paginate_modules(0, HELP_COMMANDS, 'help'), ), ) await query.answer()
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)
async def help_button(_, 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_PREFIXES)), reply_markup=InlineKeyboardMarkup( paginate_modules(0, HELP_COMMANDS, "help")), ) await query.answer()