Пример #1
0
async def helpme(message: Message):
    out, is_mdl_or_key = userge.get_help(message.input_str)
    cmd = message.input_str

    if not out:
        out_str = "__No Module or Command Found!__"

    elif isinstance(out, str):
        out_str = f"`{is_mdl_or_key}`\n\n{out}"

    elif isinstance(out, list) and is_mdl_or_key:
        out_str = """**--Which module you want ?--**

**Usage**:

    `.help [module_name]`

**Available Modules:**\n\n"""

        for i in out:
            out_str += f"    `{i}`\n"

    elif isinstance(out, list) and not is_mdl_or_key:
        out_str = f"""**--Which command you want ?--**

**Usage**:

    `.help .[command_name]`

**Available Commands Under `{cmd}` Module:**\n\n"""

        for i in out:
            out_str += f"    `{i}`\n"

    await message.edit(text=out_str, del_in=15)
Пример #2
0
async def search(message: Message):
    cmd = message.input_str
    if not cmd:
        await message.err(text="Enter any keyword to search in commands")
        return
    found = [i for i in userge.get_help(all_cmds=True)[0] if cmd in i]
    out_str = '    '.join(found)
    if found:
        out = f"**--I found ({len(found)}) commands for-- : `{cmd}`**\n\n`{out_str}`"
    else:
        out = f"__command not found for__ : `{cmd}`"
    await message.edit(text=out, del_in=0)
Пример #3
0
async def add_sudo_cmd(message: Message):
    cmd = message.input_str
    if not cmd:
        await message.err('input not found!')
        return
    cmd = cmd.lstrip(Config.CMD_TRIGGER)
    if cmd in Config.ALLOWED_COMMANDS:
        await message.edit(f"cmd : `{cmd}` already in **SUDO**!", del_in=5)
    elif cmd not in [c_d.lstrip('.') for c_d in userge.get_help(all_cmds=True)[0]]:
        await message.edit(f"cmd : `{cmd}` 🤔, is that a command ?", del_in=5)
    else:
        Config.ALLOWED_COMMANDS.add(cmd)
        SUDO_CMDS_COLLECTION.insert_one({'_id': cmd})
        await CHANNEL.log(f"cmd : `{cmd}` added to **SUDO**!")
        await message.edit(f"cmd : `{cmd}` added to **SUDO**!", del_in=5)
Пример #4
0
async def search(message: Message):
    cmd = message.input_str

    if not cmd:
        await message.err(text="Enter any keyword to search in commands")
        return

    found = '\n '.join([i for i in userge.get_help(all_cmds=True)[0] if cmd in i])

    if found:
        out = f"**--I found these commands:--**\n\n` {found}`"

    else:
        out = "__command not found!__"

    await message.edit(text=out, del_in=15)
Пример #5
0
async def helpme(message: Message):
    out, is_mdl_or_key = userge.get_help(message.input_str)
    cmd = message.input_str

    if not out:
        out_str = "__No Module or Command Found!__"

    elif isinstance(out, str):
        out_str = f"`{is_mdl_or_key}`\n\n{out}"

    elif isinstance(out, list) and is_mdl_or_key:
        out_str = f"""**--Which module you want TGTRON?--**

**Usage**:

    `.help [module_name]`

**Hint**:

    use `.s` for search commands.
    ex: `.s wel`

**({len(out)}) Modules Available:**\n\n"""

        for i in out:
            out_str += f"`{i}`    "

    elif isinstance(out, list) and not is_mdl_or_key:
        out_str = f"""**--Which command you want TGTRON?--**

**Usage**:

    `.help .[command_name]`

**Hint**:

    use `.s` for search commands.
    ex: `.s wel`

**({len(out)}) Commands Available Under `{cmd}` Module:**\n\n"""

        for i in out:
            out_str += f"`{i}`    "

    await message.edit(text=out_str, del_in=0)