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:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -4,4 +4,6 @@ settings.ini
|
|||||||
*.session-journal
|
*.session-journal
|
||||||
*.sqlite*
|
*.sqlite*
|
||||||
testing.py
|
testing.py
|
||||||
cache
|
cache
|
||||||
|
.venv
|
||||||
|
.directory
|
@@ -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)
|
||||||
|
Reference in New Issue
Block a user