Kaynağa Gözat

some fixes (#83)

* some fixes

No more error log while doing /id @wrongUsername
Avijneyam - the unknowable 5 yıl önce
ebeveyn
işleme
7cbfcdac6f
1 değiştirilmiş dosya ile 10 ekleme ve 5 silme
  1. 10 5
      wbb/modules/misc.py

+ 10 - 5
wbb/modules/misc.py

@@ -88,11 +88,16 @@ async def getid(_, message):
     text = f"**[Message ID:]({message.link})** `{message_id}`\n"
     text += f"**[Your ID:](tg://user?id={your_id})** `{your_id}`\n"
     if len(message.command) == 2:
-        split = message.text.split(None, 1)[1].strip()
-        user_id = (await app.get_users(split)).id
-        text += (
-            f"**[User ID:](tg://user?id={user_id})** `{user_id}`\n"
-        )
+        try:
+            split = message.text.split(None, 1)[1].strip()
+            user_id = (await app.get_users(split)).id
+            text += (
+                f"**[User ID:](tg://user?id={user_id})** `{user_id}`\n"
+            )
+        except Exception:
+            return await message.reply_text(
+                "This user doesn't exist."
+            )
     text += f"**[Chat ID:](https://t.me/{chat.username})** `{chat.id}`\n\n"
     if not getattr(reply, "empty", True):
         text += f"**[Replied Message ID:]({reply.link})** `{reply.message_id}`\n"