Update Ultroid v0.8
--------- Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: Aditya <me@xditya.me> Co-authored-by: Dark <darkbeamer.official@gmail.com> Co-authored-by: buddhhu <amitsharma123234@gmail.com> Co-authored-by: Kaif <88398455+kaif-00z@users.noreply.github.com> Co-authored-by: 1Danish-00 <danish@ultroid.tech> Co-authored-by: TechiError <techierror@gmail.com> Co-authored-by: Dark <59723913+DarkBeamerYT@users.noreply.github.com>
This commit is contained in:
@@ -50,22 +50,28 @@ async def _(e):
|
||||
x, y = await bash("neofetch|sed 's/\x1B\\[[0-9;\\?]*[a-zA-Z]//g' >> neo.txt")
|
||||
if y and y.endswith("NOT_FOUND"):
|
||||
return await xx.edit(f"Error: `{y}`")
|
||||
with open("neo.txt", "r") as neo:
|
||||
with open("neo.txt", "r", encoding="utf-8") as neo:
|
||||
p = (neo.read()).replace("\n\n", "")
|
||||
haa = await Carbon(code=p, file_name="neofetch", backgroundColor=choice(ATRA_COL))
|
||||
await e.reply(file=haa)
|
||||
await xx.delete()
|
||||
if isinstance(haa, dict):
|
||||
await xx.edit(f"`{haa}`")
|
||||
else:
|
||||
await e.reply(file=haa)
|
||||
await xx.delete()
|
||||
remove("neo.txt")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="bash", fullsudo=True, only_devs=True)
|
||||
async def _(event):
|
||||
carb, yamlf = None, False
|
||||
carb, rayso, yamlf = None, None, False
|
||||
try:
|
||||
cmd = event.text.split(" ", maxsplit=1)[1]
|
||||
if cmd.split()[0] in ["-c", "--carbon"]:
|
||||
cmd = cmd.split(maxsplit=1)[1]
|
||||
carb = True
|
||||
if cmd.split()[0] in ["-r", "--rayso"]:
|
||||
cmd = cmd.split(maxsplit=1)[1]
|
||||
rayso = True
|
||||
except IndexError:
|
||||
return await event.eor(get_string("devs_1"), time=10)
|
||||
xx = await event.eor(get_string("com_1"))
|
||||
@@ -88,6 +94,33 @@ async def _(event):
|
||||
download=True,
|
||||
backgroundColor=choice(ATRA_COL),
|
||||
)
|
||||
if isinstance(li, dict):
|
||||
await xx.edit(
|
||||
f"Unknown Response from Carbon: `{li}`\n\nstdout`:{stdout}`\nstderr: `{stderr}`"
|
||||
)
|
||||
return
|
||||
url = f"https://graph.org{uf(li)[-1]}"
|
||||
OUT = f"[\xad]({url}){OUT}"
|
||||
out = "**• OUTPUT:**"
|
||||
remove(li)
|
||||
elif (rayso or udB.get_key("RAYSO_ON_BASH")) and (
|
||||
event.is_private
|
||||
or event.chat.admin_rights
|
||||
or event.chat.creator
|
||||
or event.chat.default_banned_rights.embed_links
|
||||
):
|
||||
li = await Carbon(
|
||||
code=stdout,
|
||||
file_name="bash",
|
||||
download=True,
|
||||
backgroundColor=choice(ATRA_COL),
|
||||
rayso=True,
|
||||
)
|
||||
if isinstance(li, dict):
|
||||
await xx.edit(
|
||||
f"Unknown Response from Carbon: `{li}`\n\nstdout`:{stdout}`\nstderr: `{stderr}`"
|
||||
)
|
||||
return
|
||||
url = f"https://graph.org{uf(li)[-1]}"
|
||||
OUT = f"[\xad]({url}){OUT}"
|
||||
out = "**• OUTPUT:**"
|
||||
@@ -136,7 +169,7 @@ bot = ultroid = ultroid_bot
|
||||
|
||||
|
||||
class u:
|
||||
...
|
||||
_ = ""
|
||||
|
||||
|
||||
def _parse_eval(value=None):
|
||||
@@ -152,6 +185,14 @@ def _parse_eval(value=None):
|
||||
return json_parser(value, indent=1)
|
||||
except BaseException:
|
||||
pass
|
||||
elif isinstance(value, list):
|
||||
newlist = "["
|
||||
for index, child in enumerate(value):
|
||||
newlist += "\n " + str(_parse_eval(child))
|
||||
if index < len(value) - 1:
|
||||
newlist += ","
|
||||
newlist += "\n]"
|
||||
return newlist
|
||||
return str(value)
|
||||
|
||||
|
||||
@@ -161,7 +202,8 @@ async def _(event):
|
||||
cmd = event.text.split(maxsplit=1)[1]
|
||||
except IndexError:
|
||||
return await event.eor(get_string("devs_2"), time=5)
|
||||
silent, gsource, xx = False, False, None
|
||||
xx = None
|
||||
mode = ""
|
||||
spli = cmd.split()
|
||||
|
||||
async def get_():
|
||||
@@ -174,17 +216,19 @@ async def _(event):
|
||||
|
||||
if spli[0] in ["-s", "--silent"]:
|
||||
await event.delete()
|
||||
silent = True
|
||||
cmd = await get_()
|
||||
mode = "silent"
|
||||
elif spli[0] in ["-n", "-noedit"]:
|
||||
cmd = await get_()
|
||||
mode = "no-edit"
|
||||
xx = await event.reply(get_string("com_1"))
|
||||
elif spli[0] in ["-gs", "--source"]:
|
||||
gsource = True
|
||||
mode = "gsource"
|
||||
elif spli[0] in ["-ga", "--args"]:
|
||||
mode = "g-args"
|
||||
if mode:
|
||||
cmd = await get_()
|
||||
if not cmd:
|
||||
return
|
||||
if not silent and not xx:
|
||||
if not mode == "silent" and not xx:
|
||||
xx = await event.eor(get_string("com_1"))
|
||||
if black:
|
||||
try:
|
||||
@@ -220,13 +264,20 @@ async def _(event):
|
||||
stderr = redirected_error.getvalue()
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
if value and gsource:
|
||||
if value:
|
||||
try:
|
||||
exc = inspect.getsource(value)
|
||||
if mode == "gsource":
|
||||
exc = inspect.getsource(value)
|
||||
elif mode == "g-args":
|
||||
args = inspect.signature(value).parameters.values()
|
||||
name = ""
|
||||
if hasattr(value, "__name__"):
|
||||
name = value.__name__
|
||||
exc = f"**{name}**\n\n" + "\n ".join([str(arg) for arg in args])
|
||||
except Exception:
|
||||
exc = traceback.format_exc()
|
||||
evaluation = exc or stderr or stdout or _parse_eval(value) or get_string("instu_4")
|
||||
if silent:
|
||||
if mode == "silent":
|
||||
if exc:
|
||||
msg = f"• <b>EVAL ERROR\n\n• CHAT:</b> <code>{get_display_name(event.chat)}</code> [<code>{event.chat_id}</code>]"
|
||||
msg += f"\n\n∆ <b>CODE:</b>\n<code>{cmd}</code>\n\n∆ <b>ERROR:</b>\n<code>{exc}</code>"
|
||||
|
||||
Reference in New Issue
Block a user