コード例 #1
0
ファイル: help.py プロジェクト: muhammedfurkan/userbot-pyro
def add_command_help(module_name, commands):
    """
    Adds a modules help information.
    :param module_name: name of the module
    :param commands: list of lists, with command and description each.
    """

    # Key will be group name
    # values will be dict of dicts of key command and value description

    command_dict = CMD_HELP[module_name] if module_name in CMD_HELP.keys(
    ) else {}
    for x in commands:
        for y in x:
            if y is not x:
                command_dict[x[0]] = x[1]

    CMD_HELP[module_name] = command_dict
コード例 #2
0
ファイル: _inlineee.py プロジェクト: KeinShin/Black-Lightning
async def lightning_pugins_query_hndlr(lightning):
    if not lightning.query.user_id == bot.uid:
        how = "Do you Really Think This is for you? \nThen Make your own Lightning Bot and don't poke your nose in mine"
        await lightning.answer(how, cache_time=0, alert=True)
        return
    light_pulu_name = lightning.data_match.group(1).decode("UTF-8")

    if light_pulu_name in CMD_HELP.keys():

        lightning_help_strin = f"**🔺 NAME 🔺 :** `{light_pulu_name}` \n\n{CMD_HELP[light_pulu_name]}"
        lightning_is_best = lightning_help_strin
        lightning_is_best += "\n\n**In Case Any Problem**[𝐁𝐥𝐚𝐜𝐤 𝐋𝐢𝐠𝐡𝐭𝐧𝐢𝐧𝐠](https://t.me/lightning_support_group) ".format(
            light_pulu_name)

    else:
        lightning_help_strin = f"**🔺 NAME 🔺 :** `{light_pulu_name}` \n\n`{CMD_LIST[light_pulu_name]}`\n\n**Ask at @Lightning_Support_Group"
        lightning_is_best = lightning_help_strin
        lightning_is_best += "\n\n**In Case Any Problem @Lightning_support_Group** ".format(
            light_pulu_name)
    if len(lightning_is_best) >= 4096:
        keinshin = "`Wait.( ͡🔥 ͜ʖ ͡🔥)`"
        await lightning.answer(keinshin, cache_time=0, alert=True)
        out_file = lightning_is_best
        lig_url = "https://del.dog/documents"
        r = requests.post(lig_url, data=out_file.encode("UTF-8")).json()
        lig_url = f"https://del.dog/{r['key']}"
        await lightning.edit(
            f"Pasted {light_pulu_name} to {lig_url}",
            link_preview=False,
            buttons=[[custom.Button.inline("🇸‌🇵‌🇪‌🇨‌🇮‌🇦‌🇱‌", data="krish")],
                     [custom.Button.inline("Ⴆαƈƙ 💢", data="lghtback")]],
        )
    else:
        await lightning.edit(
            message=lightning_is_best,
            buttons=[
                [custom.Button.inline("🇸‌🇵‌🇪‌🇨‌🇮‌🇦‌🇱‌", data="krish")],
                [custom.Button.inline("Ⴆαƈƙ 💢", data="lghtback")],
            ],
        )
コード例 #3
0
ファイル: help.py プロジェクト: ksmaheshkumar/userbot
async def module_help(_, message: Message):
    cmd = message.command

    help_arg = ""
    if len(cmd) > 1:
        help_arg = " ".join(cmd[1:])
    elif message.reply_to_message and len(cmd) == 1:
        help_arg = message.reply_to_message.text
    elif not message.reply_to_message and len(cmd) == 1:
        all_commands = ""
        all_commands += "Please specify which module you want help for!! \nUsage: `.help [module_name]`\n\n"

        ac = PrettyTable()
        ac.header = False
        ac.title = "UserBot Modules"
        ac.align = 'l'

        for x in split_list(sorted(CMD_HELP.keys()), 2):
            ac.add_row([x[0], x[1] if len(x) >= 2 else None])

        await message.edit(f"```{str(ac)}```")

    if help_arg:
        if help_arg in CMD_HELP:
            commands: dict = CMD_HELP[help_arg]
            this_command = ""
            this_command += f"--**Help for {str(help_arg)} module**--\n".upper(
            )

            for x in commands:
                this_command += f"**{str(x)}**:\n```{str(commands[x])}```\n\n"

            await message.edit(this_command, parse_mode='markdown')
        else:
            await message.edit('`Please specify a valid module name.`',
                               parse_mode='markdown')

    await asyncio.sleep(10)
    await message.delete()