Compare commits
1 Commits
0.1.0
...
fix/issue-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bf08f9b38 |
@@ -13,6 +13,7 @@ from commands import (
|
||||
cmd_edit,
|
||||
cmd_help,
|
||||
cmd_my,
|
||||
cmd_show,
|
||||
cmd_start,
|
||||
cmd_timezone,
|
||||
cmd_track,
|
||||
@@ -43,6 +44,7 @@ def build_app() -> Application:
|
||||
app.add_handler(CommandHandler("track", cmd_track))
|
||||
app.add_handler(CommandHandler("untrack", cmd_untrack))
|
||||
app.add_handler(CommandHandler("timezone", cmd_timezone))
|
||||
app.add_handler(CommandHandler("show", cmd_show))
|
||||
|
||||
app.add_handler(MessageHandler(filters.COMMAND, cmd_help))
|
||||
|
||||
@@ -59,6 +61,7 @@ async def post_init(app: Application) -> None:
|
||||
("track", "Track a bounty"),
|
||||
("untrack", "Stop tracking"),
|
||||
("timezone", "Get/set room timezone"),
|
||||
("show", "Show bounty details"),
|
||||
("help", "Show help"),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -401,6 +401,49 @@ async def cmd_start(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def cmd_show(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
args = extract_args(update.message.text)
|
||||
if not args:
|
||||
await update.message.reply_text("Usage: /show <bounty_id>")
|
||||
return
|
||||
|
||||
try:
|
||||
bounty_id = int(args[0])
|
||||
except ValueError:
|
||||
await update.message.reply_text("Invalid bounty ID.")
|
||||
return
|
||||
|
||||
room_id = get_room_id(update)
|
||||
bounty = BOUNTY_SERVICE.get_bounty(room_id, bounty_id)
|
||||
|
||||
if not bounty:
|
||||
await update.message.reply_text("Bounty not found.")
|
||||
return
|
||||
|
||||
timezone = BOUNTY_SERVICE.get_timezone(room_id)
|
||||
|
||||
lines = []
|
||||
|
||||
title = bounty.text or "(no text)"
|
||||
lines.append(f"[#{bounty.id}] {title}")
|
||||
|
||||
due_parts = []
|
||||
if bounty.due_date_ts:
|
||||
due_str = time.strftime("%d %B %Y %H:%M", time.localtime(bounty.due_date_ts))
|
||||
due_parts.append(f"Due: {due_str} ({timezone})")
|
||||
|
||||
username = bounty.created_by_username or f"user#{bounty.created_by_user_id}"
|
||||
if bounty.link:
|
||||
due_parts.append(f"{bounty.link} by @{username}")
|
||||
else:
|
||||
due_parts.append(f"by @{username}")
|
||||
|
||||
if due_parts:
|
||||
lines.extend(due_parts)
|
||||
|
||||
await update.message.reply_text("\n".join(lines), disable_web_page_preview=True)
|
||||
|
||||
|
||||
async def cmd_help(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
await update.message.reply_text(
|
||||
"👻 JIGAIDO Commands:\n\n"
|
||||
@@ -415,6 +458,7 @@ async def cmd_help(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
"/track <id> — track a bounty (groups only)\n"
|
||||
"/untrack <id> — stop tracking (groups only)\n"
|
||||
"/timezone [tz] — get/set room timezone (admin only)\n"
|
||||
"/show <id> — show bounty details\n"
|
||||
"/start — re-initialize\n"
|
||||
"/help — this message",
|
||||
disable_web_page_preview=True,
|
||||
|
||||
Reference in New Issue
Block a user