taslim19 commited on
Commit
d583fa4
·
1 Parent(s): ef56544

fix sudoers

Browse files
Files changed (1) hide show
  1. Devine/plugins/sudo/sudoers.py +29 -15
Devine/plugins/sudo/sudoers.py CHANGED
@@ -20,6 +20,9 @@ from Devine.utils.decorators.language import language
20
  from Devine.utils.extraction import extract_user
21
  from config import BANNED_USERS, OWNER_ID, SPECIAL_USER_ID, LOG_CHANNEL_ID
22
 
 
 
 
23
  SPECIAL_USERS = {SPECIAL_USER_ID}
24
 
25
  async def log_new_sudo_user(user, adder, chat):
@@ -107,24 +110,35 @@ async def userdel(client, message: Message, language):
107
 
108
  @app.on_message(filters.command(["sudolist", "sudoers", "specialusers"]) & ~BANNED_USERS)
109
  @language
110
- async def sudoers_list(client, message: Message, _):
111
  if message.from_user.id != OWNER_ID and message.from_user.id not in SUDOERS:
112
- return await message.reply_text("ʏᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴀᴄᴄᴇss ᴛᴏ ᴜsᴇ ᴛʜɪs.\nᴠɪsɪᴛ @devine_support")
113
 
114
  text = "<b>👑 ᴅɪsᴀsᴛᴇʀs ᴏғ ᴀɴᴏᴛʜᴇʀ ʟᴇᴠᴇʟ.</b>\n\n"
115
  text += "<b>๏ ᴍʏ ʟᴏʀᴅ</b>\n"
 
116
  user = user.first_name if not hasattr(user, "mention") else user.mention
117
- text += f"神 <a href='tg://openmessage?user_id=5758713974' target='_blank'>{user}</a>\n\n"
118
 
119
- text += "<b>❄️ sᴜᴅᴏᴇʀs</b>\n"
120
- if not SUDOERS:
121
- text += "ᴛʜᴇʀᴇ ᴀʀᴇ ɴᴏ sᴜᴅᴏᴇʀs ᴄᴜʀʀᴇɴᴛʟʏ."
122
- else:
123
- for sudo_id in SUDOERS:
124
- if sudo_id == OWNER_ID:
125
- continue
126
- user = await app.get_users(sudo_id)
127
- user = user.first_name if not hasattr(user, "mention") else user.mention
128
- text += f"» {user}\n"
129
-
130
- await message.reply_text(text)
 
 
 
 
 
 
 
 
 
 
 
20
  from Devine.utils.extraction import extract_user
21
  from config import BANNED_USERS, OWNER_ID, SPECIAL_USER_ID, LOG_CHANNEL_ID
22
 
23
+ # Define the special user ID
24
+ SPECIAL_USER_ID = 6466741329 # Replace with the actual user ID
25
+
26
  SPECIAL_USERS = {SPECIAL_USER_ID}
27
 
28
  async def log_new_sudo_user(user, adder, chat):
 
110
 
111
  @app.on_message(filters.command(["sudolist", "sudoers", "specialusers"]) & ~BANNED_USERS)
112
  @language
113
+ async def sudoers_list(client, message: Message, language):
114
  if message.from_user.id != OWNER_ID and message.from_user.id not in SUDOERS:
115
+ return # Ignore message from non-owner, non-sudoers and non-special-id
116
 
117
  text = "<b>👑 ᴅɪsᴀsᴛᴇʀs ᴏғ ᴀɴᴏᴛʜᴇʀ ʟᴇᴠᴇʟ.</b>\n\n"
118
  text += "<b>๏ ᴍʏ ʟᴏʀᴅ</b>\n"
119
+ user = await app.get_users(OWNER_ID)
120
  user = user.first_name if not hasattr(user, "mention") else user.mention
121
+ text += f"神 {user}\n\n"
122
 
123
+ text += "<b>🔱 sᴘᴇᴄɪᴀʟ ᴅɪsᴀsᴛᴇʀs</b>\n"
124
+ user = await app.get_users(SPECIAL_USER_ID)
125
+ user = user.first_name if not hasattr(user, "mention") else user.mention
126
+ text += f"‣ {user}\n"
127
+
128
+ text += "\n<b>❄️ sᴜᴅᴏ ᴜsᴇʀs</b>\n"
129
+ count = 0
130
+ for user_id in SUDOERS:
131
+ if user_id != OWNER_ID:
132
+ try:
133
+ user = await app.get_users(user_id)
134
+ user = user.first_name if not hasattr(user, "mention") else user.mention
135
+ count += 1
136
+ text += f"» {user}\n"
137
+ except Exception as e:
138
+ print(f"Error fetching user {user_id}: {e}")
139
+ continue
140
+
141
+ if count == 0:
142
+ text += "<b>‣ ɴᴏ ᴜsᴇʀs ᴀᴜᴛʜᴏʀɪsᴇᴅ ғᴏʀ ᴇʟᴇᴠᴀᴛᴇᴅ ᴀᴄᴄᴇss.</b>"
143
+
144
+ await message.reply_text(text, reply_markup=close_markup(language))