Ver código fonte

fix: welcome message bug (#261)

SI_NN_ER_LS 2 anos atrás
pai
commit
e8fbb11fd5
3 arquivos alterados com 9 adições e 5 exclusões
  1. 1 1
      wbb/modules/greetings.py
  2. 3 3
      wbb/modules/rules.py
  3. 5 1
      wbb/modules/sudoers.py

+ 1 - 1
wbb/modules/greetings.py

@@ -240,7 +240,7 @@ async def handle_new_member(member, chat):
 async def welcome(_, user: ChatMemberUpdated):
     if not (
         user.new_chat_member
-        and user.new_chat_member.status in {CMS.RESTRICTED}
+        and user.new_chat_member.status not in {CMS.RESTRICTED}
         and not user.old_chat_member
     ):
         return

+ 3 - 3
wbb/modules/rules.py

@@ -35,11 +35,11 @@ from wbb.utils.functions import check_format
 
 __MODULE__ = "Rules"
 __HELP__ = """
- • `/rules`: get the rules for this chat.
+ • /rules: get the rules for this chat.
 
 **Admins only:**
- • `/setrules`: Reply to a message to set the rules for the chat.
- • `/clearrules`: clear the rules for this chat.
+ • /setrules: Reply to a message to set the rules for the chat.
+ • /clearrules: clear the rules for this chat.
 """
 
 

+ 5 - 1
wbb/modules/sudoers.py

@@ -194,7 +194,9 @@ async def unban_globally(_, message):
 async def broadcast_message(_, message):
     sleep_time = 0.1
     reply_message = message.reply_to_message
-
+    if not reply_message:
+        return await message.reply_text("Reply to a message to broadcast it")
+        
     sent = 0
     schats = await get_served_chats()
     chats = [int(chat["chat_id"]) for chat in schats]
@@ -251,6 +253,8 @@ async def broadcast_message(_, message):
     schats = await get_served_users()
     chats = [int(chat["user_id"]) for chat in schats]
     reply_message = message.reply_to_message
+    if not reply_message:
+        return await message.reply_text("Reply to a message to broadcast it")
 
     m = await message.reply_text(
         f"Broadcast in progress, will take {len(chats) * sleep_time} seconds."