Spaces:
Paused
Paused
dragpro commited on
Update plugins/devtools.py
Browse files- plugins/devtools.py +16 -10
plugins/devtools.py
CHANGED
|
@@ -17,7 +17,7 @@ from os import remove
|
|
| 17 |
from pprint import pprint
|
| 18 |
|
| 19 |
from telethon.utils import get_display_name
|
| 20 |
-
|
| 21 |
from pyUltroid import _ignore_eval
|
| 22 |
|
| 23 |
from . import *
|
|
@@ -323,19 +323,25 @@ def _stringify(text=None, *args, **kwargs):
|
|
| 323 |
|
| 324 |
|
| 325 |
async def aexec(code, event):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
exec(
|
| 327 |
(
|
| 328 |
-
"async def __aexec(e, client):
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
)
|
| 335 |
-
+ "".join(f"\n
|
|
|
|
| 336 |
)
|
| 337 |
-
|
| 338 |
-
return await locals()["__aexec"](event, event.client)
|
| 339 |
|
| 340 |
|
| 341 |
DUMMY_CPP = """#include <iostream>
|
|
|
|
| 17 |
from pprint import pprint
|
| 18 |
|
| 19 |
from telethon.utils import get_display_name
|
| 20 |
+
from pyUltroid import to_video # adjust as needed
|
| 21 |
from pyUltroid import _ignore_eval
|
| 22 |
|
| 23 |
from . import *
|
|
|
|
| 323 |
|
| 324 |
|
| 325 |
async def aexec(code, event):
|
| 326 |
+
global_vars = {
|
| 327 |
+
"to_video": to_video, # Add any function you want accessible here
|
| 328 |
+
"_stringify": _stringify,
|
| 329 |
+
"p": pprint,
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
exec(
|
| 333 |
(
|
| 334 |
+
"async def __aexec(e, client):"
|
| 335 |
+
"\n print = p = _stringify"
|
| 336 |
+
"\n message = event = e"
|
| 337 |
+
"\n u.r = reply = await event.get_reply_message()"
|
| 338 |
+
"\n chat = event.chat_id"
|
| 339 |
+
"\n u.lr = locals()"
|
| 340 |
)
|
| 341 |
+
+ "".join(f"\n {l}" for l in code.split("\n")),
|
| 342 |
+
global_vars,
|
| 343 |
)
|
| 344 |
+
return await global_vars["__aexec"](event, event.client)
|
|
|
|
| 345 |
|
| 346 |
|
| 347 |
DUMMY_CPP = """#include <iostream>
|