debug: add logging to cmd_start for troubleshooting admin promotion

Adding logging to understand why group creator admin promotion
may not be working in production.
This commit is contained in:
shokollm
2026-04-04 16:01:24 +00:00
parent 8ac8cd21ec
commit cce71e55c2

View File

@@ -438,14 +438,24 @@ async def cmd_untrack(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
async def cmd_start(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
user_id = get_user_id(update)
room_id = get_room_id(update)
import logging
logging.info(
f"cmd_start: user_id={user_id}, room_id={room_id}, is_group={is_group(update)}"
)
if is_group(update):
try:
chat_member = await ctx.bot.get_chat_member(room_id, user_id)
logging.info(f"cmd_start: chat_member.status={chat_member.status}")
if chat_member.status == "creator" and not BOUNTY_SERVICE.is_admin(
room_id, user_id
):
logging.info(f"cmd_start: Promoting user {user_id} to admin")
BOUNTY_SERVICE.add_admin(room_id, user_id, user_id)
logging.info(
f"cmd_start: After add_admin, is_admin={BOUNTY_SERVICE.is_admin(room_id, user_id)}"
)
await update.message.reply_text(
"👻 JIGAIDO is watching.\n\n"
"This group's bounty list is now active.\n"
@@ -456,7 +466,8 @@ async def cmd_start(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
"/my — your tracked bounties"
)
return
except Exception:
except Exception as e:
logging.error(f"cmd_start: Exception in group start: {e}")
pass
await update.message.reply_text(
@@ -469,6 +480,7 @@ async def cmd_start(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
)
else:
if not BOUNTY_SERVICE.is_admin(room_id, user_id):
logging.info(f"cmd_start: DM - promoting user {user_id} to admin")
BOUNTY_SERVICE.add_admin(room_id, user_id, user_id)
await update.message.reply_text(