log.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from pyrogram import filters, types
  2. import re
  3. from wbb.utils import cust_filter, nekobin
  4. from wbb import app, OWNER_ID
  5. __MODULE__ = "Logs"
  6. __HELP__ = "/log - To Get Logs From Last Run [Owner Only]"
  7. @app.on_message(filters.user(OWNER_ID) & cust_filter.command("log"))
  8. async def logs_chat(client, message):
  9. keyb = types.InlineKeyboardMarkup(
  10. [
  11. [
  12. types.InlineKeyboardButton(
  13. "Paste on Nekobin", callback_data="paste_log_nekobin"
  14. )
  15. ]
  16. ]
  17. )
  18. await message.reply_document(
  19. "error.log", caption="**Here are my Logs ~**", reply_markup=keyb
  20. )
  21. def logs_callback(_, __, query):
  22. if re.match("paste_log_nekobin", query.data):
  23. return True
  24. logs_create = filters.create(logs_callback)
  25. @app.on_callback_query(logs_create)
  26. async def paste_log_neko(client, query):
  27. if query.from_user.id == OWNER_ID:
  28. f = open("error.log", "r")
  29. data = await nekobin.neko(f.read())
  30. keyb = types.InlineKeyboardMarkup(
  31. [[types.InlineKeyboardButton("pasted on nekobin", url=f"{data}")]]
  32. )
  33. await query.message.edit_caption("Successfully Nekofied", reply_markup=keyb)
  34. else:
  35. await client.answer_callback_query(
  36. query.id, "'Blue Button Must Press', huh?", show_alert=True
  37. )