This commit is contained in:
levina 2021-12-02 12:44:30 +07:00 committed by GitHub
parent 6065dda30c
commit 73b2e6807c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,10 +70,8 @@ async def update_repo(_, message: Message):
@Client.on_message(command(["restart", f"restart@{BOT_USERNAME}"]) & ~filters.edited)
@sudo_users_only
async def restart_bot(_, message: Message):
m = await message.reply_text("🔄 `restarting bot...`")
await sleep(3)
os.execl(sys.executable, sys.executable, *sys.argv)
try:
await m.edit("✅ **Bot restarted successfully.**\n\n• **You can use this bot again**")
except BaseException:
pass
msg = await message.reply("`restarting bot...`")
args = [sys.executable, "main.py"]
await msg.edit("✅ bot restarted\n\n• now you can use this bot again.")
execle(sys.executable, *args, environ)
return