taslim19
commited on
Commit
·
1d2866f
1
Parent(s):
5a014fc
blah blah
Browse files
DragMusic/plugins/kuri/devtools.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Devtools plugin for userbot-only development and admin commands.
|
3 |
Provides /sh, /xsh for shell commands and /eval, /e for Python code evaluation.
|
4 |
Also triggers if the message starts with 'sh', 'xsh', 'e', or 'eval' (with or without a slash or exclamation mark, and with any capitalization).
|
5 |
-
Restricted to OWNER_ID only.
|
6 |
"""
|
7 |
|
8 |
import asyncio
|
@@ -12,18 +12,13 @@ from pyrogram.types import Message
|
|
12 |
from DragMusic import userbot
|
13 |
from config import OWNER_ID
|
14 |
|
15 |
-
# Helper to check if the message is from OWNER_ID
|
16 |
-
async def is_owner(message: Message):
|
17 |
-
return message.from_user and message.from_user.id == OWNER_ID
|
18 |
-
|
19 |
# Regex filters for command matching (case-insensitive)
|
20 |
sh_filter = filters.user(OWNER_ID) & filters.regex(r"^[!/]*x?sh( |$)", re.IGNORECASE)
|
21 |
eval_filter = filters.user(OWNER_ID) & filters.regex(r"^[!/]*(e|eval)( |$)", re.IGNORECASE)
|
22 |
|
23 |
@userbot.one.on_message(sh_filter)
|
24 |
async def shell_command_handler(client, message: Message):
|
25 |
-
|
26 |
-
return
|
27 |
parts = message.text.split(None, 1)
|
28 |
if len(parts) < 2:
|
29 |
await message.reply_text("Usage: sh <command>")
|
@@ -50,8 +45,7 @@ async def shell_command_handler(client, message: Message):
|
|
50 |
|
51 |
@userbot.one.on_message(eval_filter)
|
52 |
async def eval_handler(client, message: Message):
|
53 |
-
|
54 |
-
return
|
55 |
parts = message.text.split(None, 1)
|
56 |
if len(parts) < 2:
|
57 |
await message.reply_text("Usage: eval <python code>")
|
|
|
2 |
Devtools plugin for userbot-only development and admin commands.
|
3 |
Provides /sh, /xsh for shell commands and /eval, /e for Python code evaluation.
|
4 |
Also triggers if the message starts with 'sh', 'xsh', 'e', or 'eval' (with or without a slash or exclamation mark, and with any capitalization).
|
5 |
+
Restricted to OWNER_ID only. Usable in any chat where the userbot is present.
|
6 |
"""
|
7 |
|
8 |
import asyncio
|
|
|
12 |
from DragMusic import userbot
|
13 |
from config import OWNER_ID
|
14 |
|
|
|
|
|
|
|
|
|
15 |
# Regex filters for command matching (case-insensitive)
|
16 |
sh_filter = filters.user(OWNER_ID) & filters.regex(r"^[!/]*x?sh( |$)", re.IGNORECASE)
|
17 |
eval_filter = filters.user(OWNER_ID) & filters.regex(r"^[!/]*(e|eval)( |$)", re.IGNORECASE)
|
18 |
|
19 |
@userbot.one.on_message(sh_filter)
|
20 |
async def shell_command_handler(client, message: Message):
|
21 |
+
print("sh/xsh command received from OWNER_ID") # Debug print
|
|
|
22 |
parts = message.text.split(None, 1)
|
23 |
if len(parts) < 2:
|
24 |
await message.reply_text("Usage: sh <command>")
|
|
|
45 |
|
46 |
@userbot.one.on_message(eval_filter)
|
47 |
async def eval_handler(client, message: Message):
|
48 |
+
print("eval command received from OWNER_ID") # Debug print
|
|
|
49 |
parts = message.text.split(None, 1)
|
50 |
if len(parts) < 2:
|
51 |
await message.reply_text("Usage: eval <python code>")
|