TheHamkerCat 5 jaren geleden
bovenliggende
commit
20c4219cfc
3 gewijzigde bestanden met toevoegingen van 46 en 2 verwijderingen
  1. 1 0
      requirements.txt
  2. 1 2
      wbb/__main__.py
  3. 44 0
      wbb/modules/alive.py

+ 1 - 0
requirements.txt

@@ -1,3 +1,4 @@
+pykeyboard
 requests
 python-arq
 TgCrypto

+ 1 - 2
wbb/__main__.py

@@ -20,8 +20,7 @@ async def start_bot():
     global COMMANDS_COUNT
     await app2.start()
     await app.start()
-    await get_info(app, app2)
-    init_sudo()
+    await get_info(app, app2) 
 
     for module in ALL_MODULES:
         imported_module = importlib.import_module("wbb.modules." + module)

+ 44 - 0
wbb/modules/alive.py

@@ -0,0 +1,44 @@
+from wbb import app, app2
+from wbb.utils.errors import capture_err
+from pykeyboard import InlineKeyboard
+from platform import python_version as pyver
+from motor import version as mongover
+from pyrogram import __version__ as pyrover
+from pyrogram import filters
+from pyrogram.types import (
+    InlineQueryResultArticle,
+    InputTextMessageContent,
+    InlineKeyboardButton
+)
+
+
+async def alive_function(answers):
+    buttons = InlineKeyboard(row_width=1)
+    bot_state = 'dead' if not await app.get_me() else 'alive'
+    ubot_state = 'dead' if not await app2.get_me() else 'alive'
+    buttons.add(InlineKeyboardButton('Stats', callback_data='stats_callback'))
+    msg = f"""
+**[William✨](https://github.com/thehamkercat/WilliamButcherBot):**
+**MainBot:** `{bot_state}`
+**UserBot:** `{ubot_state}`
+**Pyrogram:** `{pyrover}`
+**Python:** `{pyver}`
+**MongoDB:** `{mongover}`
+"""
+    answers.append(
+        InlineQueryResultArticle(
+            title='Alive',
+            description='William ✨',
+            input_message_content=InputTextMessageContent(
+                msg,
+                disable_web_page_preview=True
+                ),
+            reply_markup=buttons,
+            )
+        )
+
+
+@app.on_inline_query()
+async def inline_query_handler(client, query):
+    answers = []
+    await alive_function(answers)