From a6ba39593f33fffb784cd1ec16fbe166744f24a7 Mon Sep 17 00:00:00 2001 From: Champu <117635421+TheChampu@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:02:48 +0530 Subject: [PATCH] Update sudoers.py --- ChampuMusic/plugins/sudo/sudoers.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ChampuMusic/plugins/sudo/sudoers.py b/ChampuMusic/plugins/sudo/sudoers.py index 423cfb6..e21a629 100644 --- a/ChampuMusic/plugins/sudo/sudoers.py +++ b/ChampuMusic/plugins/sudo/sudoers.py @@ -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}")]) @@ -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