소스 검색

Name length

TheHamkerCat 5 년 전
부모
커밋
5a53fdb667
1개의 변경된 파일과 4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      wbb/modules/greetings.py

+ 4 - 0
wbb/modules/greetings.py

@@ -30,6 +30,10 @@ async def welcome(_, message: Message):
             "You will be removed from this chat if you are not verified "
             f"in {WELCOME_DELAY_KICK_SEC} seconds")
         await message.chat.restrict_member(member.id, ChatPermissions())
+        user = await app.get_users(member.id)
+        name_length = len(str(user.first_name) + str(user.last_name))
+        if name_lenth > 50:
+            await message.reply_text("[ERROR: MAX_NAME_LENGH_EXCEEDED]: Your Name Is Too Long And Weird, Change It!")
 
         button_message = await message.reply(
             text,