feat: auto-promote group creator to admin
When /start is called in a group, check if user is the group creator and automatically add them as admin. DMs don't need admin concept.
This commit is contained in:
@@ -436,7 +436,29 @@ async def cmd_untrack(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def cmd_start(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)
|
||||||
|
|
||||||
if is_group(update):
|
if is_group(update):
|
||||||
|
try:
|
||||||
|
chat_member = await ctx.bot.get_chat_member(room_id, user_id)
|
||||||
|
if chat_member.status == "creator" and not BOUNTY_SERVICE.is_admin(
|
||||||
|
room_id, user_id
|
||||||
|
):
|
||||||
|
BOUNTY_SERVICE.add_admin(room_id, user_id, user_id)
|
||||||
|
await update.message.reply_text(
|
||||||
|
"👻 JIGAIDO is watching.\n\n"
|
||||||
|
"This group's bounty list is now active.\n"
|
||||||
|
"You are now an admin (group creator).\n"
|
||||||
|
"/bounty — list bounties\n"
|
||||||
|
"/add — create a bounty\n"
|
||||||
|
"/track — track a bounty\n"
|
||||||
|
"/my — your tracked bounties"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
await update.message.reply_text(
|
await update.message.reply_text(
|
||||||
"👻 JIGAIDO is watching.\n\n"
|
"👻 JIGAIDO is watching.\n\n"
|
||||||
"This group's bounty list is now active.\n"
|
"This group's bounty list is now active.\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user