From a1946e4c4ed76125b3105aced6b1adab348e1339 Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Sun, 5 Apr 2026 01:36:30 +0000 Subject: [PATCH] feat: store username when creating bounty for display When adding a bounty, capture effective_user's username or first_name and store it for display in /show. Now shows actual name instead of just "User". --- apps/telegram-bot/commands.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/telegram-bot/commands.py b/apps/telegram-bot/commands.py index e429e50..0739dae 100644 --- a/apps/telegram-bot/commands.py +++ b/apps/telegram-bot/commands.py @@ -359,6 +359,9 @@ async def cmd_add(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None: room_id = get_room_id(update) timezone_str = BOUNTY_SERVICE.get_timezone(room_id) + effective_user = update.effective_user + username = effective_user.username or effective_user.first_name or None + text, link, due_date_ts, _, _ = parse_args(args, timezone_str) if not text and not link: await update.message.reply_text("A bounty needs at least text or a link.") @@ -371,6 +374,7 @@ async def cmd_add(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None: text=text, link=link, due_date_ts=due_date_ts, + created_by_username=username, ) except PermissionError as e: await update.message.reply_text(f"⛔ {e}") @@ -662,7 +666,10 @@ async def cmd_show(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None: due_str = dt_due.strftime("%d %B %Y %H:%M") lines.append(f"📅 {due_str} ({timezone_str})") - lines.append(f'👤 User') + display_name = bounty.created_by_username or f"User {bounty.created_by_user_id}" + lines.append( + f'👤 {display_name}' + ) dt_created = datetime.fromtimestamp(bounty.created_at, tz=tz) created_str = dt_created.strftime("%Y-%m-%d %H:%M")