Skip to content

Commit

Permalink
Added Exclusive Features 😎
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnoAyanOfficial committed Jun 12, 2020
1 parent 35e667e commit 10b6ece
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion userbot/plugins/_helper.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from userbot import CMD_LIST
from userbot.utils import admin_cmd
import sys
from telethon import events, functions, __version__

@command(pattern="^.help ?(.*)")
#@borg.on(admin_cmd(pattern=r"help ?(.*)"))
async def cmd_list(event):
if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"):
tgbotusername = Var.TG_BOT_USER_NAME_BF_HER
input_str = event.pattern_match.group(1)
if tgbotusername is None or input_str == "text":
string = ""
for i in CMD_LIST:
string += "ℹ️ " + i + "\n"
string += " " + i + "\n"
for iter_list in CMD_LIST[i]:
string += " `" + str(iter_list) + "`"
string += "\n"
Expand Down Expand Up @@ -48,3 +52,19 @@ async def cmd_list(event):
hide_via=True
)
await event.delete()

@borg.on(admin_cmd(pattern="syntax (.*)"))
async def _(event):
if event.fwd_from:
return
plugin_name = event.pattern_match.group(1)
if plugin_name in borg._plugins:
help_string = borg._plugins[plugin_name].__doc__
unload_string = f"Use `.unload {plugin_name}` to remove this plugin.\n © @UniBorg"
if help_string:
plugin_syntax = f"Syntax for plugin **{plugin_name}**:\n\n{help_string}\n{unload_string}"
else:
plugin_syntax = f"No DOCSTRING has been setup for {plugin_name} plugin."
else:
plugin_syntax = "Enter valid **Plugin** name.\nDo `.exec ls stdplugins` or `.helpme` to get list of valid plugin names."
await event.edit(plugin_syntax)

0 comments on commit 10b6ece

Please sign in to comment.