[set] setup logger

This commit is contained in:
levina 2022-02-25 11:08:11 +07:00 committed by GitHub
parent 725e0669a3
commit 5dd6192801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/licenses.html
""" """
import os
import re import re
import uuid import uuid
import socket import socket
@ -68,3 +69,20 @@ async def give_sysinfo(client, message):
**DISK :** `{disk}` **DISK :** `{disk}`
""" """
await message.reply(somsg) await message.reply(somsg)
@Client.on_message(command(["logs", f"logs@{BOT_USERNAME}"]) & ~filters.edited)
@sudo_users_only
async def get_bot_logs(c: Client, m: Message):
bot_log_path = 'bot.logs'
if os.path.exists(bot_log_path):
try:
await m.reply_document(
bot_log_path,
quote=True,
caption='📄 This is the bot logs',
)
except BaseException:
os.remove(bot_log_path)
if not os.path.exists(bot_log_path):
await m.reply_text('❌ no logs found !')