AI Update: تغییرات مهم خاطرات عمومی فقط از طریق بات قابل مشاهده و ویرای
This commit is contained in:
+10
-1
@@ -2395,6 +2395,9 @@ async def graceful_bot_restart(delay_after_done: float = 1.5, max_wait: float =
|
||||
|
||||
await asyncio.sleep(1.5)
|
||||
|
||||
await asyncio.sleep(delay_after_done)
|
||||
os.system("systemctl restart --no-block agy-telegram-bot.service &")
|
||||
|
||||
# Command: /upload or /drop
|
||||
@check_auth
|
||||
async def upload_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
@@ -6253,8 +6256,14 @@ def main():
|
||||
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, message_handler))
|
||||
application.add_handler(MessageHandler(filters.Document.ALL | filters.PHOTO | filters.VOICE | filters.AUDIO, file_handler))
|
||||
|
||||
# Global Error Handler
|
||||
async def global_error_handler(update: object, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
logger.error("Unhandled exception in telegram update handler:", exc_info=context.error)
|
||||
|
||||
application.add_error_handler(global_error_handler)
|
||||
|
||||
logger.info("Starting Telegram Bot Polling...")
|
||||
application.run_polling(drop_pending_updates=True)
|
||||
application.run_polling(drop_pending_updates=False)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -928,7 +928,7 @@ async def execute_action(
|
||||
break
|
||||
await asyncio.sleep(1.5)
|
||||
await asyncio.sleep(2.0)
|
||||
os.system("systemctl restart agy-telegram-bot.service")
|
||||
os.system("systemctl restart --no-block agy-telegram-bot.service &")
|
||||
|
||||
side_effects.append(do_restart)
|
||||
badge = (
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user