Skip to content

Commit

Permalink
Update __main__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AbirHasan2005 authored Feb 25, 2022
1 parent 8d9c398 commit 100505a
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions bot/__main__.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,7 @@
# (c) @AbirHasan2005

import os
import sys
import bot
import shutil
import asyncio
from pyrogram import idle
from configs import Config
from sqlite3 import OperationalError


def rm_st():
try: shutil.rmtree(Config.DOWNLOAD_DIR)
except: pass
try: os.remove("RenameBot.session")
except: pass
try: os.remove("RenameBot.session-journal")
except: pass


def run_bot():
async def runner():
await bot.bot.start()
await idle()
await bot.bot.stop()

rm_st()
asyncio.get_event_loop().run_until_complete(runner())


if __name__ == "__main__":
try:
run_bot()
except OperationalError:
rm_st()
os.execl(sys.executable, sys.executable, *sys.argv)
bot.bot.run()

0 comments on commit 100505a

Please sign in to comment.