f.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. from wbb.utils.errors import capture_err
  6. i = 0
  7. m = None
  8. pressers = []
  9. keyboard = InlineKeyboardMarkup(
  10. [
  11. [
  12. InlineKeyboardButton("F", callback_data="ff"),
  13. InlineKeyboardButton("Delete", callback_data="deletef")
  14. ]
  15. ]
  16. )
  17. @app.on_message(filters.command("f"))
  18. @capture_err
  19. async def f(_, message):
  20. global i, m, pressers
  21. i = 0
  22. pressers = []
  23. try:
  24. await m.delete()
  25. except:
  26. pass
  27. admins = await list_admins(message.chat.id)
  28. if message.from_user.id not in admins:
  29. return
  30. m = await app.send_message(message.chat.id, text=f"Press F To Pay Respect.\nRespect = `{i}`", reply_markup=keyboard)
  31. @app.on_callback_query(filters.regex("ff"))
  32. async def end_callbacc(_, CallbackQuery):
  33. global i, m, pressers
  34. i += 1
  35. user_id = CallbackQuery.from_user.id
  36. if user_id in pressers:
  37. await app.answer_callback_query(CallbackQuery.id,
  38. "Didn't You Already Pressed 'F' like 0.0069 Seconds Ago?",
  39. show_alert=True
  40. )
  41. return
  42. pressers.append(user_id)
  43. await m.edit(text=f"Press F To Pay Respect.\nRespect = `{i}`", reply_markup=keyboard)
  44. await app.answer_callback_query(CallbackQuery.id, "Respect +", show_alert=True)
  45. @app.on_callback_query(filters.regex("deletef"))
  46. async def del_callbacc(_, CallbackQuery):
  47. admins = await list_admins(CallbackQuery.message.chat.id)
  48. if CallbackQuery.from_user.id not in admins:
  49. return
  50. global i, m, pressers
  51. pressers = []
  52. i = 0
  53. await m.delete()