webook / monitor_handlers.py
Mohammed Foud
Add application file
f959aff
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import ContextTypes
import logging
logger = logging.getLogger(__name__)
class MonitorHandlers:
def __init__(self, bot):
self.bot = bot
async def handle_country_selection(self, query, context):
"""Handle country selection for monitoring"""
keyboard = [
[InlineKeyboardButton("πŸ‡ΈπŸ‡¦ Saudi Arabia", callback_data='monitor_country_SA')],
[InlineKeyboardButton("πŸ‡¦πŸ‡ͺ UAE", callback_data='monitor_country_AE')],
[InlineKeyboardButton("πŸ‡ΆπŸ‡¦ Qatar", callback_data='monitor_country_QA')],
[InlineKeyboardButton("⬅️ Back", callback_data='start_monitoring')]
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
"🌍 Select a country to monitor events from:",
reply_markup=reply_markup
)
async def handle_date_selection(self, query, context):
"""Handle date filter selection for monitoring"""
keyboard = [
[InlineKeyboardButton("β˜€οΈ Today", callback_data='monitor_date_today')],
[InlineKeyboardButton("πŸ—“οΈ Tomorrow", callback_data='monitor_date_tomorrow')],
[InlineKeyboardButton("πŸ“… This Week", callback_data='monitor_date_this_week')],
[InlineKeyboardButton("⬅️ Back", callback_data='start_monitoring')]
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
"πŸ“… Select a date filter for monitoring:",
reply_markup=reply_markup
)
async def handle_category_selection(self, query, context):
"""Handle category selection for monitoring"""
keyboard = [
[InlineKeyboardButton("🎁 Offers", callback_data='monitor_category_offers')],
[InlineKeyboardButton("⚽ Sports", callback_data='monitor_category_sports-events')],
[InlineKeyboardButton("🎭 Theater", callback_data='monitor_category_theater-and-performing-arts')],
[InlineKeyboardButton("⬅️ Back", callback_data='start_monitoring')]
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.edit_message_text(
"🎯 Select a category to monitor:",
reply_markup=reply_markup
)
async def handle_price_range(self, query, context):
"""Handle price range selection for monitoring"""
# This would typically involve a conversation flow to get min/max prices
await query.edit_message_text(
"πŸ’° Please enter the price range in the format:\n"
"min-max\n"
"Example: 100-500\n"
"Or enter 'any' for no price filter"
)
context.user_data['awaiting_price_range'] = True