Jelajahi Sumber

fix: issue in /promote

TheHamkerCat 3 tahun lalu
induk
melakukan
ac3ff3a465
2 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 1 0
      .gitignore
  2. 4 1
      wbb/modules/admin.py

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+whisper.py
 mirror.py
 dump
 *.m4a

+ 4 - 1
wbb/modules/admin.py

@@ -447,14 +447,17 @@ async def deleteFunc(_, message: Message):
 @adminsOnly("can_promote_members")
 async def promoteFunc(_, message: Message):
     user_id = await extract_user(message)
-    umention = (await app.get_users(user_id)).mention
     if not user_id:
         return await message.reply_text("I can't find that user.")
+    
     bot = await app.get_chat_member(message.chat.id, BOT_ID)
     if user_id == BOT_ID:
         return await message.reply_text("I can't promote myself.")
     if not bot.can_promote_members:
         return await message.reply_text("I don't have enough permissions")
+
+    umention = (await app.get_users(user_id)).mention
+    
     if message.command[0][0] == "f":
         await message.chat.promote_member(
             user_id=user_id,