refactor(telegram-bot): add /edit command and make bot.py minimal entrypoint

- Add cmd_edit as alias for cmd_update
- Update bot.py to import commands directly instead of via module
- Register /edit command in bot and post_init commands list
- Clean up unused imports in bot.py

Fixes #14
This commit is contained in:
shokollm
2026-04-03 14:27:01 +00:00
parent f5cb28d45c
commit 67d801d9de
2 changed files with 34 additions and 20 deletions

View File

@@ -84,7 +84,7 @@ def get_user_id(update: Update) -> int:
def get_room_id(update: Update) -> int:
"""Get room_id for the current context.
For groups: negative group_id
For DMs: positive user_id
"""
@@ -116,7 +116,11 @@ async def cmd_my(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
bounties = BOUNTY_SERVICE.list_bounties(room_id)
if not bounties:
msg = "You are not tracking any bounties." if is_group(update) else "No personal bounties."
msg = (
"You are not tracking any bounties."
if is_group(update)
else "No personal bounties."
)
await update.message.reply_text(msg)
return
@@ -200,6 +204,9 @@ async def cmd_update(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text("Bounty not found.")
cmd_edit = cmd_update
async def cmd_delete(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
args = extract_args(update.message.text)
if not args: