log.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. @app.on_message(filters.user(OWNER_ID) & cust_filter.command("log"))
  6. async def logs_chat(client, message):
  7. keyb = types.InlineKeyboardMarkup(
  8. [
  9. [
  10. types.InlineKeyboardButton(
  11. "Paste on Nekobin", callback_data="paste_log_nekobin"
  12. )
  13. ]
  14. ]
  15. )
  16. await message.reply_document(
  17. "akagi/logs/error.log", caption="✨ **Here are my Logs ~**", reply_markup=keyb
  18. )
  19. def logs_callback(_, __, query):
  20. if re.match("paste_log_nekobin", query.data):
  21. return True
  22. logs_create = filters.create(logs_callback)
  23. @app.on_callback_query(logs_create)
  24. async def paste_log_neko(client, query):
  25. if query.from_user.id is OWNER_ID:
  26. f = open("wbb/logs/error.log", "r")
  27. data = await nekobin.neko(f.read())
  28. keyb = types.InlineKeyboardMarkup(
  29. [[types.InlineKeyboardButton("pasted on nekobin", url=f"{data}")]]
  30. )
  31. await query.message.edit_caption("Successfully Nekofied", reply_markup=keyb)
  32. else:
  33. await client.answer_callback_query(
  34. query.id, "Sike its not for you!", show_alert=True
  35. )