[check] some changes

This commit is contained in:
levina 2022-02-25 11:53:35 +07:00 committed by GitHub
parent d298e315c0
commit 03a160830f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,11 @@ import psutil
import platform import platform
from config import BOT_USERNAME from config import BOT_USERNAME
from program import LOGS
from driver.core import me_bot
from driver.filters import command from driver.filters import command
from driver.utils import remove_if_exists
from driver.decorators import sudo_users_only, humanbytes from driver.decorators import sudo_users_only, humanbytes
from pyrogram import Client, filters from pyrogram import Client, filters
@ -74,7 +78,8 @@ async def give_sysinfo(c: Client, message: Message):
@Client.on_message(command(["logs", f"logs@{BOT_USERNAME}"]) & ~filters.edited) @Client.on_message(command(["logs", f"logs@{BOT_USERNAME}"]) & ~filters.edited)
@sudo_users_only @sudo_users_only
async def get_bot_logs(c: Client, m: Message): async def get_bot_logs(c: Client, m: Message):
bot_log_path = 'bot.logs' id = me_bot.id
bot_log_path = f'streambot-logs-{id}.txt'
if os.path.exists(bot_log_path): if os.path.exists(bot_log_path):
try: try:
await m.reply_document( await m.reply_document(
@ -82,7 +87,8 @@ async def get_bot_logs(c: Client, m: Message):
quote=True, quote=True,
caption='📄 This is the bot logs', caption='📄 This is the bot logs',
) )
except BaseException: remove_if_exists(bot_log_path)
os.remove(bot_log_path) except BaseException as err:
LOGS.info(f'[ERROR]: {err}')
if not os.path.exists(bot_log_path): if not os.path.exists(bot_log_path):
await m.reply_text('❌ no logs found !') await m.reply_text('❌ no logs found !')