|
@@ -2,6 +2,8 @@ import sys
|
|
|
import traceback
|
|
import traceback
|
|
|
from io import StringIO
|
|
from io import StringIO
|
|
|
import os
|
|
import os
|
|
|
|
|
+import re
|
|
|
|
|
+import subprocess
|
|
|
from inspect import getfullargspec
|
|
from inspect import getfullargspec
|
|
|
from wbb import app, OWNER_ID
|
|
from wbb import app, OWNER_ID
|
|
|
from pyrogram import filters
|
|
from pyrogram import filters
|
|
@@ -84,7 +86,7 @@ async def executor(client, message):
|
|
|
)
|
|
)
|
|
|
async def shellrunner(client, message):
|
|
async def shellrunner(client, message):
|
|
|
if len(message.command) < 2:
|
|
if len(message.command) < 2:
|
|
|
- await message.reply_text(message, text='**Usage:**\n/sh git pull')
|
|
|
|
|
|
|
+ await edit_or_reply(message, text='**Usage:**\n/sh git pull')
|
|
|
return
|
|
return
|
|
|
text = message.text.split(None, 1)[1]
|
|
text = message.text.split(None, 1)[1]
|
|
|
if '\n' in text:
|
|
if '\n' in text:
|
|
@@ -98,7 +100,7 @@ async def shellrunner(client, message):
|
|
|
)
|
|
)
|
|
|
except Exception as err:
|
|
except Exception as err:
|
|
|
print(err)
|
|
print(err)
|
|
|
- await message.reply_text(
|
|
|
|
|
|
|
+ await edit_or_reply(
|
|
|
message,
|
|
message,
|
|
|
text=f"**Error:**\n```{err}```")
|
|
text=f"**Error:**\n```{err}```")
|
|
|
output += f'**{code}**\n'
|
|
output += f'**{code}**\n'
|
|
@@ -118,7 +120,7 @@ async def shellrunner(client, message):
|
|
|
errors = traceback.format_exception(
|
|
errors = traceback.format_exception(
|
|
|
etype=exc_type, value=exc_obj, tb=exc_tb,
|
|
etype=exc_type, value=exc_obj, tb=exc_tb,
|
|
|
)
|
|
)
|
|
|
- await message.reply_text(
|
|
|
|
|
|
|
+ await edit_or_reply(
|
|
|
message,
|
|
message,
|
|
|
text="**Error:**\n```{''.join(errors)}```")
|
|
text="**Error:**\n```{''.join(errors)}```")
|
|
|
return
|
|
return
|
|
@@ -137,11 +139,11 @@ async def shellrunner(client, message):
|
|
|
)
|
|
)
|
|
|
os.remove('output.txt')
|
|
os.remove('output.txt')
|
|
|
return
|
|
return
|
|
|
- await message.reply_text(
|
|
|
|
|
|
|
+ await edit_or_reply(
|
|
|
message,
|
|
message,
|
|
|
text="**Output:**\n```{output}```"
|
|
text="**Output:**\n```{output}```"
|
|
|
)
|
|
)
|
|
|
else:
|
|
else:
|
|
|
- await message.reply_text(
|
|
|
|
|
|
|
+ await edit_or_reply(
|
|
|
message,
|
|
message,
|
|
|
text='**Output: **\n`No output`')
|
|
text='**Output: **\n`No output`')
|