f.py 1.6 KB

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