f.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
  2. from wbb import app
  3. from pyrogram import filters
  4. from wbb.modules.admin import list_admins
  5. i = 0
  6. m = None
  7. pressers = []
  8. keyboard = InlineKeyboardMarkup(
  9. [
  10. [
  11. InlineKeyboardButton("F", callback_data="f"),
  12. InlineKeyboardButton("Delete", callback_data="delete")
  13. ]
  14. ]
  15. )
  16. @app.on_message(filters.command("f"))
  17. async def f(_, message):
  18. global i, m
  19. admins = await list_admins(message.chat.id)
  20. if message.from_user.id not in admins:
  21. return
  22. m = await app.send_message(message.chat.id, text=f"Press F To Pay Respect.\nRespect = `{i}`", reply_markup=keyboard)
  23. @app.on_callback_query(filters.regex("f"))
  24. async def end_callback(_, CallbackQuery):
  25. global i, m, pressers
  26. i += 1
  27. user_id = CallbackQuery.from_user.id
  28. if user_id in pressers:
  29. await app.answer_callback_query(CallbackQuery.id,
  30. "Didn't You Already Pressed 'F' like 0.0069 Seconds Ago?",
  31. show_alert=True
  32. )
  33. return
  34. pressers.append(user_id)
  35. await m.edit(text=f"Press F To Pay Respect.\nRespect = `{i}`", reply_markup=keyboard)
  36. await app.answer_callback_query(CallbackQuery.id, "Respect +", show_alert=True)
  37. @app.on_callback_query(filters.regex("delete"))
  38. async def del_callback(_, CallbackQuery):
  39. admins = await list_admins(CallbackQuery.message.chat.id)
  40. if CallbackQuery.from_user.id not in admins:
  41. return
  42. global i, m, pressers
  43. pressers = []
  44. i = 0
  45. await m.delete()