Skip to content

Commit

Permalink
Update sudoers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
TheChampu committed Oct 23, 2024
1 parent 74b6515 commit a6ba395
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ChampuMusic/plugins/sudo/sudoers.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ async def check_sudo_list(client, callback_query: CallbackQuery):
else:
user = await app.get_users(OWNER_ID)

user_mention = (user.first_name if not user.mention else user.mention)
# Ensure user is a single object and handle it accordingly
if isinstance(user, list):
user_mention = ", ".join([u.mention for u in user if hasattr(u, 'mention')]) or "Unknown User"
else:
user_mention = user.mention if hasattr(user, 'mention') else user.first_name

caption = f"**˹ʟɪsᴛ ᴏғ ʙᴏᴛ ᴍᴏᴅᴇʀᴀᴛᴏʀs˼**\n\n**🌹Oᴡɴᴇʀ** ➥ {user_mention}\n\n"

keyboard.append([InlineKeyboardButton("๏ ᴠɪᴇᴡ ᴏᴡɴᴇʀ ๏", url=f"tg://openmessage?user_id={OWNER_ID}")])
Expand All @@ -74,10 +79,10 @@ async def check_sudo_list(client, callback_query: CallbackQuery):
user_mention = user.mention if user else f"**🎁 Sᴜᴅᴏ {count} ɪᴅ:** {user_id}"
caption += f"**🎁 Sᴜᴅᴏ** {count} **»** {user_mention}\n"
button_text = f"๏ ᴠɪᴇᴡ sᴜᴅᴏ {count} ๏ "
keyboard.append([InlineKeyboardButton(button_text, url=f"tg://openmessage?user_id={user_id}")]
)
keyboard.append([InlineKeyboardButton(button_text, url=f"tg://openmessage?user_id={user_id}")])
count += 1
except:
except Exception as e:
logging.error(f"Error fetching user {user_id}: {e}")
continue

# Add a "Back" button at the end
Expand Down

0 comments on commit a6ba395

Please sign in to comment.