TheHamkerCat 5 年之前
父节点
当前提交
b73359166b
共有 2 个文件被更改,包括 9 次插入 和 8 次删除
  1. 1 6
      wbb/modules/eval.py
  2. 8 2
      wbb/modules/greetings.py

+ 1 - 6
wbb/modules/eval.py

@@ -59,12 +59,7 @@ async def executor(client, message):
         evaluation = stdout
     else:
         evaluation = "Success"
-    final_output = (
-        "**QUERY**:\n```{}```\n\n**OUTPUT**:\n```{}```".format(
-            cmd,
-            evaluation.strip()
-        )
-    )
+    final_output = (f"**OUTPUT**:\n```{evaluation.strip()}``")
     if len(final_output) > 4096:
         filename = "output.txt"
         with open(filename, "w+", encoding="utf8") as out_file:

+ 8 - 2
wbb/modules/greetings.py

@@ -15,7 +15,7 @@ from pyrogram import filters
 from wbb import app, WELCOME_DELAY_KICK_SEC
 from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
 from pyrogram.types import ChatPermissions
-from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant
+from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant, ChatAdminRequired
 
 
 @app.on_message(filters.new_chat_members)
@@ -25,7 +25,13 @@ async def welcome(_, message: Message):
     text = (f"Welcome, {', '.join(new_members)}\n**Are you human?**\n"
             "You will be removed from this chat if you are not verified "
             f"in {WELCOME_DELAY_KICK_SEC} seconds")
-    await message.chat.restrict_member(message.from_user.id, ChatPermissions())
+    try:
+        await message.chat.restrict_member(message.from_user.id, ChatPermissions())
+    except ChatAdminRequired:
+        msg = "Yeah, I Can't Verify Newly Joined Members, Make Sure I'm Admin."
+        await message.reply_text(msg)
+        return
+
     button_message = await message.reply(
         text,
         reply_markup=InlineKeyboardMarkup(