Spaces:
Running
Running
taslim19
commited on
Commit
·
5a014fc
1
Parent(s):
544053d
Restrict devtools.py commands to OWNER_ID only for userbot access
Browse files
DragMusic/plugins/kuri/devtools.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
"""
|
2 |
-
Devtools plugin for userbot-only
|
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.
|
@@ -17,8 +17,8 @@ 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.
|
21 |
-
eval_filter = filters.
|
22 |
|
23 |
@userbot.one.on_message(sh_filter)
|
24 |
async def shell_command_handler(client, message: Message):
|
|
|
1 |
"""
|
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.
|
|
|
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):
|