瀏覽代碼

Reqs & Inline

TheHamkerCat 5 年之前
父節點
當前提交
66ecf4f93f
共有 2 個文件被更改,包括 20 次插入 和 7 次删除
  1. 17 7
      wbb/modules/alive.py
  2. 3 0
      wbb/modules/sudoers.py

+ 17 - 7
wbb/modules/alive.py

@@ -1,7 +1,8 @@
-from wbb import app, app2
+import sys
+from wbb import app, app2, SUDOERS
 from wbb.utils.errors import capture_err
 from pykeyboard import InlineKeyboard
-from platform import python_version as pyver
+from sys import version as pyver
 from motor import version as mongover
 from pyrogram import __version__ as pyrover
 from pyrogram import filters
@@ -10,25 +11,27 @@ from pyrogram.types import (
     InputTextMessageContent,
     InlineKeyboardButton
 )
+""" Inspiration From https://github.com/pokurt/Nana-Remix/blob/master/nana/plugins/assistant/inline_mod/alive.py """
 
 
 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'
+    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}`
+**Python:** `{pyver.split()[0]}`
 **Pyrogram:** `{pyrover}`
-**Python:** `{pyver}`
 **MongoDB:** `{mongover}`
+**Platform:** `{sys.platform}`
 """
     answers.append(
         InlineQueryResultArticle(
             title='Alive',
-            description='William ✨',
+            description="Check Bot's Stats",
             input_message_content=InputTextMessageContent(
                 msg,
                 disable_web_page_preview=True
@@ -36,9 +39,16 @@ async def alive_function(answers):
             reply_markup=buttons,
             )
         )
+    return answers
 
 
 @app.on_inline_query()
 async def inline_query_handler(client, query):
     answers = []
-    await alive_function(answers)
+    answerss = await alive_function(answers)
+    await client.answer_inline_query(
+        query.id,
+        results=answerss,
+        switch_pm_text=f'Hello',
+        switch_pm_parameter='start',
+    )

+ 3 - 0
wbb/modules/sudoers.py

@@ -105,11 +105,14 @@ async def get_speedtest_result(_, message):
 
 
 async def bot_sys_stats():
+    from wbb.utils.botinfo import USERBOT_USERNAME
     bot_uptime = int(time.time() - bot_start_time)
     cpu = psutil.cpu_percent(interval=0.5)
     mem = psutil.virtual_memory().percent
     disk = psutil.disk_usage("/").percent
     stats = f'''
+{USERBOT_USERNAME}@William
+------------------
 Uptime: {formatter.get_readable_time((bot_uptime))}
 CPU: {cpu}%
 RAM: {mem}%