f.py 1.7 KB

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