Spaces:
Sleeping
Sleeping
Commit ·
5d9d37f
1
Parent(s): 3cbf2d1
update
Browse files- bot/plugins/eval.py +19 -22
- bot/plugins/ping.py +5 -5
- requirements.txt +2 -0
bot/plugins/eval.py
CHANGED
|
@@ -43,27 +43,24 @@ async def evaluation_cmd_t(client, message: Message):
|
|
| 43 |
await status_message.delete()
|
| 44 |
else:
|
| 45 |
await status_message.edit_text(final_output)
|
|
|
|
|
|
|
| 46 |
|
| 47 |
async def aexec(code, client, message):
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
async def __aexec(client, message)
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
# Execute the combined code
|
| 66 |
-
exec(full_code)
|
| 67 |
-
|
| 68 |
-
# Call the dynamically defined function
|
| 69 |
-
return await locals()["__aexec"](client, message)
|
|
|
|
| 43 |
await status_message.delete()
|
| 44 |
else:
|
| 45 |
await status_message.edit_text(final_output)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
|
| 49 |
async def aexec(code, client, message):
|
| 50 |
+
exec(
|
| 51 |
+
(
|
| 52 |
+
"async def __aexec(client, message):\n"
|
| 53 |
+
+ " import os\n"
|
| 54 |
+
+ " import wget\n"
|
| 55 |
+
+ " neo = message\n"
|
| 56 |
+
+ " message = event = neo = e\n"
|
| 57 |
+
+ " r = reply = message.reply_to_message\n"
|
| 58 |
+
+ " chat = message.chat.id\n"
|
| 59 |
+
+ " c = client\n"
|
| 60 |
+
+ " to_photo = message.reply_photo\n"
|
| 61 |
+
+ " to_video = message.reply_video\n"
|
| 62 |
+
+ " p = print\n"
|
| 63 |
+
)
|
| 64 |
+
+ "".join(f"\n {l}" for l in code.split("\n"))
|
| 65 |
+
)
|
| 66 |
+
return await locals()["__aexec"](client, message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bot/plugins/ping.py
CHANGED
|
@@ -49,7 +49,7 @@ async def fetch_server_status():
|
|
| 49 |
except Exception as e:
|
| 50 |
return f"Error: {str(e)}"
|
| 51 |
|
| 52 |
-
def get_caption(duration: float, uptime: str, is_premium: bool, server_status: str) -> str:
|
| 53 |
"""Generate the caption for the ping response."""
|
| 54 |
if is_premium:
|
| 55 |
return f"**Pong !!** `{duration}ms`\n**Uptime** - `{uptime}`\n**Server:** {server_status}"
|
|
@@ -60,7 +60,7 @@ def get_caption(duration: float, uptime: str, is_premium: bool, server_status: s
|
|
| 60 |
f"🤴 **Oᴡɴᴇʀ :** {client.me.mention}"
|
| 61 |
)
|
| 62 |
|
| 63 |
-
async def send_ping_response(message: Message, duration: float, uptime: str, is_premium: bool, server_status: str, photo=None):
|
| 64 |
"""Send the ping response with optional photo."""
|
| 65 |
caption = get_caption(duration, uptime, is_premium, server_status)
|
| 66 |
if photo:
|
|
@@ -103,14 +103,14 @@ async def custom_ping_handler(client, message: Message):
|
|
| 103 |
server_status = await fetch_server_status()
|
| 104 |
|
| 105 |
if PING_DISABLE_NONPREM.get(message.from_user.id):
|
| 106 |
-
await lol.edit_text(get_caption(duration, uptime, is_premium, server_status))
|
| 107 |
return
|
| 108 |
|
| 109 |
if is_anime:
|
| 110 |
photo = waifu_random() if is_anime.get("anime") else waifu_hentai() if is_anime.get("hentai") else None
|
| 111 |
if photo:
|
| 112 |
-
await send_ping_response(message, duration, uptime, is_premium, server_status, photo)
|
| 113 |
await lol.delete()
|
| 114 |
return
|
| 115 |
|
| 116 |
-
await send_ping_response(message, duration, uptime, is_premium, server_status)
|
|
|
|
| 49 |
except Exception as e:
|
| 50 |
return f"Error: {str(e)}"
|
| 51 |
|
| 52 |
+
def get_caption(client, duration: float, uptime: str, is_premium: bool, server_status: str) -> str:
|
| 53 |
"""Generate the caption for the ping response."""
|
| 54 |
if is_premium:
|
| 55 |
return f"**Pong !!** `{duration}ms`\n**Uptime** - `{uptime}`\n**Server:** {server_status}"
|
|
|
|
| 60 |
f"🤴 **Oᴡɴᴇʀ :** {client.me.mention}"
|
| 61 |
)
|
| 62 |
|
| 63 |
+
async def send_ping_response(client, message: Message, duration: float, uptime: str, is_premium: bool, server_status: str, photo=None):
|
| 64 |
"""Send the ping response with optional photo."""
|
| 65 |
caption = get_caption(duration, uptime, is_premium, server_status)
|
| 66 |
if photo:
|
|
|
|
| 103 |
server_status = await fetch_server_status()
|
| 104 |
|
| 105 |
if PING_DISABLE_NONPREM.get(message.from_user.id):
|
| 106 |
+
await lol.edit_text(get_caption(client, duration, uptime, is_premium, server_status))
|
| 107 |
return
|
| 108 |
|
| 109 |
if is_anime:
|
| 110 |
photo = waifu_random() if is_anime.get("anime") else waifu_hentai() if is_anime.get("hentai") else None
|
| 111 |
if photo:
|
| 112 |
+
await send_ping_response(client, message, duration, uptime, is_premium, server_status, photo)
|
| 113 |
await lol.delete()
|
| 114 |
return
|
| 115 |
|
| 116 |
+
await send_ping_response(client, message, duration, uptime, is_premium, server_status)
|
requirements.txt
CHANGED
|
@@ -5,3 +5,5 @@ tgcrypto
|
|
| 5 |
quart
|
| 6 |
uvicorn
|
| 7 |
psutil
|
|
|
|
|
|
|
|
|
| 5 |
quart
|
| 6 |
uvicorn
|
| 7 |
psutil
|
| 8 |
+
wget
|
| 9 |
+
|