fix: logs and errors

This commit is contained in:
allinoneallinone00
2024-07-14 10:20:46 +00:00
parent 12cc86a69a
commit 0eb5d15882
2 changed files with 20 additions and 0 deletions

View File

@@ -49,6 +49,8 @@ async def restart_cmd(_, message: Message):
return
await message.edit("<b>Restarting...</b>")
if os.path.exists("moonlogs.txt"):
os.remove("moonlogs.txt")
restart()
@@ -97,6 +99,8 @@ async def update(_, message: Message):
db.remove("core.updater", "restart_info")
else:
await message.edit("<b>Updating: done! Restarting...</b>")
if os.path.exists("moonlogs.txt"):
os.remove("moonlogs.txt")
restart()

View File

@@ -34,6 +34,21 @@ async def upl(client: Client, message: Message):
await message.edit(format_exc(e))
@Client.on_message(filters.command("moonlogs", prefix) & filters.me)
async def upl(client: Client, message: Message):
link = "moonlogs.txt"
try:
if os.path.exists(link):
await message.edit("<b>Uploading Now...</b>")
await client.send_document(message.chat.id, link)
await message.delete()
return await message.edit(
f"<b>Error: </b><code>LOGS</code> file doesn't exist."
)
except Exception as e:
await message.edit(format_exc(e))
@Client.on_message(filters.command("uplr", prefix) & filters.me)
async def uplr(client: Client, message: Message):
if len(message.command) > 1:
@@ -67,4 +82,5 @@ async def uplr(client: Client, message: Message):
modules_help["uplud"] = {
"upl [filepath]/[reply to path]*": "Upload a file from your local machine to Telegram",
"uplr [filepath]/[reply to path]*": "Upload a file from your local machine to Telegram, delete the file after uploading",
"moonlogs": "Upload the moonlogs.txt file to Telegram"
}