diff --git a/app/plugins/sys_utils/cmdinfo.py b/app/plugins/sys_utils/cmdinfo.py deleted file mode 100644 index 5820a8b..0000000 --- a/app/plugins/sys_utils/cmdinfo.py +++ /dev/null @@ -1,39 +0,0 @@ -import os - -from app import BOT, Config, Message, bot - - -@bot.add_cmd(cmd="ci") -async def cmd_info(bot: BOT, message: Message): - """ - CMD: CI (CMD INFO) - INFO: Get Github File URL of a Command. - USAGE: .ci ci - """ - cmd = message.filtered_input - if not cmd or cmd not in Config.CMD_DICT.keys(): - await message.reply("Give a valid cmd.", del_in=5) - return - cmd_path = Config.CMD_DICT[cmd].cmd_path - plugin_path = os.path.relpath(cmd_path, os.curdir) - repo = Config.REPO.remotes.origin.url - branch = Config.REPO.active_branch - remote_url = os.path.join(str(repo), "blob", str(branch), plugin_path) - resp_str = ( - f"
Command: {cmd}"
- f"\nPath: {cmd_path}"
- f"\nLink: Github"
- )
- await message.reply(resp_str, disable_web_page_preview=True)
-
-
-@bot.add_cmd(cmd="s")
-async def search(bot: BOT, message: Message):
- search_str = message.input
-
- if not search_str:
- await message.reply("Give some input to search commands.")
- return
-
- cmds = [cmd for cmd in Config.CMD_DICT.keys() if search_str in cmd]
- await message.reply(f"{cmds}")
diff --git a/app/plugins/sys_utils/help.py b/app/plugins/sys_utils/help.py
deleted file mode 100644
index 795c049..0000000
--- a/app/plugins/sys_utils/help.py
+++ /dev/null
@@ -1,38 +0,0 @@
-from collections import defaultdict
-
-from app import BOT, Config, Message, bot
-
-
-@bot.add_cmd(cmd="help")
-async def cmd_list(bot: BOT, message: Message) -> None:
- """
- CMD: HELP
- INFO: Check info/about available cmds.
- USAGE:
- .help help | .help
- """
- cmd = message.input.strip()
- if not cmd:
- await message.reply(text=get_cmds(), del_in=30, block=True)
- elif cmd not in Config.CMD_DICT.keys():
- await message.reply(
- text=f"Invalid {cmd}, check {message.trigger}help", del_in=5
- )
- else:
- raw_help_str = Config.CMD_DICT[cmd].doc
- parsed_str = "\n".join(
- [x.replace(" ", "", 1) for x in raw_help_str.splitlines()]
- )
- await message.reply(text=f"{parsed_str}", del_in=30)
-
-
-def get_cmds() -> str:
- dir_dict = defaultdict(list)
- for cmd in Config.CMD_DICT.values():
- dir_dict[cmd.dirname].append(cmd.cmd)
- sorted_keys = sorted(dir_dict.keys())
- help_str = ""
- for key in sorted_keys:
- help_str += f"\n\n\n{key.capitalize()}:\n"
- help_str += f"{dir_dict[key]}"
- return help_str
diff --git a/app/plugins/sys_utils/repo.py b/app/plugins/sys_utils/repo.py
deleted file mode 100644
index 5890709..0000000
--- a/app/plugins/sys_utils/repo.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from app import BOT, Config, Message, bot
-
-
-@bot.add_cmd(cmd="repo")
-async def sauce(bot: BOT, message: Message) -> None:
- await bot.send_message(
- chat_id=message.chat.id,
- text=f"{Config.BOT_NAME}",
- reply_to_message_id=message.reply_id or message.id,
- disable_web_page_preview=True,
- )
diff --git a/app/plugins/tg_tools/cancel.py b/app/plugins/tg_tools/cancel.py
deleted file mode 100644
index 8ba4fde..0000000
--- a/app/plugins/tg_tools/cancel.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import asyncio
-
-from app import BOT, Message, bot
-
-
-@bot.add_cmd(cmd="c")
-async def cancel_task(bot: BOT, message: Message) -> Message | None:
- """
- CMD: CANCEL
- INFO: Cancel a running command by replying to a message.
- USAGE: .c
- """
- task_id: str | None = message.replied_task_id
- if not task_id:
- return await message.reply(
- text="Reply To a Command or Bot's Response Message.", del_in=8
- )
- all_tasks: set[asyncio.all_tasks] = asyncio.all_tasks()
- tasks: list[asyncio.Task] | None = [x for x in all_tasks if x.get_name() == task_id]
- if not tasks:
- return await message.reply(
- text="Task not in Currently Running Tasks.", del_in=8
- )
- response: str = ""
- for task in tasks:
- status: bool = task.cancel()
- response += f"Task: __{task.get_name()}__\nCancelled: __{status}__\n"
- await message.reply(response, del_in=5)
diff --git a/app/plugins/sys_utils/ping.py b/app/plugins/tg_tools/ping.py
similarity index 100%
rename from app/plugins/sys_utils/ping.py
rename to app/plugins/tg_tools/ping.py