2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-22 01:58:17 +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
*.sqlite*
testing.py
cache
cache
.venv
.directory

View File

@ -5,6 +5,7 @@ import os
import sys
from datetime import timedelta
from platform import python_version
from shutil import which
from time import time
from traceback import print_exc
@ -119,20 +120,20 @@ async def update_bot(event):
@ldr.add("sysd", sudo=True, hide_help=True)
async def sysd(event):
try:
neo = "neofetch --stdout"
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:
if which("neofetch") is not None:
command = "neofetch --stdout"
else:
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)