alive.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. from wbb import app, app2
  2. from wbb.utils.errors import capture_err
  3. from pykeyboard import InlineKeyboard
  4. from platform import python_version as pyver
  5. from motor import version as mongover
  6. from pyrogram import __version__ as pyrover
  7. from pyrogram import filters
  8. from pyrogram.types import (
  9. InlineQueryResultArticle,
  10. InputTextMessageContent,
  11. InlineKeyboardButton
  12. )
  13. async def alive_function(answers):
  14. buttons = InlineKeyboard(row_width=1)
  15. bot_state = 'dead' if not await app.get_me() else 'alive'
  16. ubot_state = 'dead' if not await app2.get_me() else 'alive'
  17. buttons.add(InlineKeyboardButton('Stats', callback_data='stats_callback'))
  18. msg = f"""
  19. **[William✨](https://github.com/thehamkercat/WilliamButcherBot):**
  20. **MainBot:** `{bot_state}`
  21. **UserBot:** `{ubot_state}`
  22. **Pyrogram:** `{pyrover}`
  23. **Python:** `{pyver}`
  24. **MongoDB:** `{mongover}`
  25. """
  26. answers.append(
  27. InlineQueryResultArticle(
  28. title='Alive',
  29. description='William ✨',
  30. input_message_content=InputTextMessageContent(
  31. msg,
  32. disable_web_page_preview=True
  33. ),
  34. reply_markup=buttons,
  35. )
  36. )
  37. @app.on_inline_query()
  38. async def inline_query_handler(client, query):
  39. answers = []
  40. await alive_function(answers)