- Add /recover command for listing and recovering soft-deleted bounties - /recover - list recoverable bounties (admin only) - /recover <id> [<id>...] - recover specific bounties (admin only) - Fix /admin list to show @username instead of admin_id - Add recover_bounty and recover_bounties methods to BountyService - Add get_deleted_bounty method to BountyService - Clean up duplicate cmd_admin functions - Add /recover to bot command menu - Fixes #49 and #50
28 lines
869 B
Python
28 lines
869 B
Python
#!/usr/bin/env python3
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
|
|
# Run from the telegram-bot directory so local imports work
|
|
os.chdir("/home/shoko/repositories/jigaido/apps/telegram-bot")
|
|
sys.path.insert(0, "/home/shoko/repositories/jigaido")
|
|
|
|
# Import main from the local bot module
|
|
import bot as bot_module
|
|
|
|
if __name__ == "__main__":
|
|
if not bot_module.BOT_TOKEN:
|
|
bot_module.log.error("JIGAIDO_BOT_TOKEN environment variable not set.")
|
|
sys.exit(1)
|
|
|
|
app = bot_module.build_app()
|
|
app.post_init = bot_module.post_init
|
|
bot_module.log.info("JIGAIDO starting...")
|
|
|
|
# PTB v20+ app.run_polling() is async - use asyncio.get_event_loop() + run_until_complete
|
|
loop = asyncio.new_event_loop()
|
|
asyncio.set_event_loop(loop)
|
|
try:
|
|
loop.run_until_complete(app.run_polling(drop_pending_updates=True))
|
|
finally:
|
|
loop.close() |