-
Notifications
You must be signed in to change notification settings - Fork 5
/
cmd.py
43 lines (38 loc) · 1.42 KB
/
cmd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Made by @LEGENDX22 FOR LEGEND BOT
import asyncio
import io
from ULTRA.utils import admin_cmd
from ULTRA import CMD_HELP
# @command(pattern="^.cmds", outgoing=True)
@borg.on(admin_cmd(pattern=r"cmds"))
async def install(event):
if event.fwd_from:
return
reply_to_id = event.message.id
if event.reply_to_msg_id:
reply_to_id = event.reply_to_msg_id
cmd = "ls ULTRA/plugins"
process = await asyncio.create_subprocess_shell(
cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await process.communicate()
o = stdout.decode()
_o = o.split("\n")
o = "\n".join(_o)
OUTPUT = f"**List of Plugins:**\n - {o}\n\n**HELP:** __If you want to know the commands for a plugin, do:-__ \n `.help <plugin name>` **without the < > brackets.**\n__All modules might not work directly. Visit__ @teamishere __for assistance.__"
if len(OUTPUT) > 69:
with io.BytesIO(str.encode(OUTPUT)) as out_file:
out_file.name = "cmd_list.text"
await bot.send_file(
event.chat_id,
out_file,
force_document=True,
allow_cache=False,
caption=cmd,
reply_to=reply_to_id,
)
await event.delete()
await event.edit(OUTPUT)
CMD_HELP.update(
{"command_list": ".cmds\nUsage - Extracts all the plugins of this ULTRA in a link.."}
)