Phase 1: Ruff lint fixes - Remove unused imports across all files - Remove unused variables (now_utc, tz, ctx) - Fix f-string without placeholders - Fix E402 import order with noqa comments Phase 2: Remove confusing hard delete from storage - Removed delete_bounty() from RoomStorage Protocol (never used by app) - Removed delete_bounty() from JsonFileRoomStorage (was hard delete) - Removed corresponding tests (hard delete was never used) Phase 3: Sync SPEC.md with actual code behavior - Updated overview: admins can add/edit/delete (not 'anyone' + 'creator') - Updated command table: /add, /edit, /delete are admin only - Updated error handling messages Test results: 96 passed (2 hard delete tests removed)
28 lines
883 B
Python
28 lines
883 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 # noqa: E402
|
|
|
|
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() |