瀏覽代碼

smol fixes

TheHamkerCat 5 年之前
父節點
當前提交
372630ace0
共有 2 個文件被更改,包括 14 次插入 和 10 次删除
  1. 1 0
      wbb/modules/inline.py
  2. 13 10
      wbb/utils/inlinefuncs.py

+ 1 - 0
wbb/modules/inline.py

@@ -13,6 +13,7 @@ __HELP__ = '''```
 - webss [URL] - Take Screenshot Of A Website.
 - bitly [URL] - Shorten A Link.
 - wall [QUERY] - Find Wallpapers.
+- music [QUERY] - Get Music.
 - saavn [SONG_NAME] - Get Songs From Saavn.
 - deezer [SONG_NAME] - Get Songs From Deezer.
 - yt [Query] - Youtube Search.

+ 13 - 10
wbb/utils/inlinefuncs.py

@@ -118,19 +118,22 @@ async def urban_func(answers, text):
         if limit > 48:
             break
         limit += 1
-        msg = f"""
-**Query:** {text}
+        try:
+            msg = f"""
+    **Query:** {text}
 
-**Definition:** __{results[i].definition}__
+    **Definition:** __{results[i].definition}__
 
-**Example:** __{results[i].example}__"""
+    **Example:** __{results[i].example}__"""
 
-        answers.append(
-            InlineQueryResultArticle(
-                title=results[i].word,
-                description=results[i].definition,
-                input_message_content=InputTextMessageContent(msg)
-            ))
+            answers.append(
+                InlineQueryResultArticle(
+                    title=results[i].word,
+                    description=results[i].definition,
+                    input_message_content=InputTextMessageContent(msg)
+                ))
+        except KeyError:
+            pass
     return answers