2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-30 22:16:05 +00:00

ignore venv/directory files, better check for neofetch

This commit is contained in:
Nick80835
2024-09-28 16:16:03 -04:00
parent a27fe7ea70
commit 621652d9a4
2 changed files with 17 additions and 14 deletions

4
.gitignore vendored
View File

@@ -4,4 +4,6 @@ settings.ini
*.session-journal *.session-journal
*.sqlite* *.sqlite*
testing.py testing.py
cache cache
.venv
.directory

View File

@@ -5,6 +5,7 @@ import os
import sys import sys
from datetime import timedelta from datetime import timedelta
from platform import python_version from platform import python_version
from shutil import which
from time import time from time import time
from traceback import print_exc from traceback import print_exc
@@ -119,20 +120,20 @@ async def update_bot(event):
@ldr.add("sysd", sudo=True, hide_help=True) @ldr.add("sysd", sudo=True, hide_help=True)
async def sysd(event): async def sysd(event):
try: if which("neofetch") is not None:
neo = "neofetch --stdout" command = "neofetch --stdout"
else:
fetch = await asyncio.create_subprocess_shell(
neo,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, stderr = await fetch.communicate()
await event.reply(f"`{stdout.decode().strip()}{stderr.decode().strip()}`")
except FileNotFoundError:
await event.reply("Neofetch not found!") await event.reply("Neofetch not found!")
return
fetch = await asyncio.create_subprocess_shell(
command,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, stderr = await fetch.communicate()
await event.reply(f"```{stdout.decode().strip()}{stderr.decode().strip()}```")
@ldr.add("alive", sudo=True, hide_help=True) @ldr.add("alive", sudo=True, hide_help=True)