fix: handle admin_user_ids=None case in add_admin

When loading room data with admin_user_ids=null in JSON,
the code now properly initializes admin_user_ids to []
instead of incorrectly creating a new RoomData.

Also removed debug logging added during troubleshooting.
This commit is contained in:
shokollm
2026-04-04 22:59:37 +00:00
parent 6e5006b429
commit badb2e3292
2 changed files with 2 additions and 42 deletions

View File

@@ -438,24 +438,14 @@ 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"
@@ -466,8 +456,7 @@ async def cmd_start(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
"/my — your tracked bounties"
)
return
except Exception as e:
logging.error(f"cmd_start: Exception in group start: {e}")
except Exception:
pass
await update.message.reply_text(
@@ -480,7 +469,6 @@ 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(