cursor.execute("SELECT COUNT(*) FROM stbemu_codes WHERE status='active'") stbemu_active = cursor.fetchone()[0]
def validate_xtream_url(url): """Validate Xtream Codes URL""" pattern = r'^https?://[^\s/]+(:[0-9]+)?/?$' return re.match(pattern, url) is not None async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): """Send welcome message with options""" keyboard = [ [InlineKeyboardButton("📺 Get Xtream Code", callback_data='get_xtream')], [InlineKeyboardButton("📡 Get STBEmu Code", callback_data='get_stbemu')], [InlineKeyboardButton("ℹ️ My Codes", callback_data='my_codes')], [InlineKeyboardButton("❓ Help", callback_data='help')] ] reply_markup = InlineKeyboardMarkup(keyboard)
message = f""" ✅ Your Xtream Code is ready! Stbemu Codes and Xtream Codes - Telegram channel
await update.message.reply_text(stats_text, parse_mode='Markdown') def main(): """Start the bot""" # Create application application = Application.builder().token(TOKEN).build()
# ... rest of the code
# Assign to user db.assign_code_to_user(user_id, 'stbemu', code_id)
Code Types: • Xtream Codes - For apps like TiviMate, IPTV Smarters • STBEmu Codes - For STBEmu emulator cursor
🌐 Server: {server_url} 👤 Username: {username} 🔑 Password: {password} 📱 Max Connections: {max_conn} ⏰ Valid until: {expiry.strftime('%Y-%m-%d %H:%M')}
code_id, mac_address, server_url, portal_name, expiry = code [InlineKeyboardButton("📡 Get STBEmu Code"
await update.callback_query.edit_message_text( message, parse_mode='Markdown' ) async def show_help(update: Update, context: ContextTypes.DEFAULT_TYPE): """Show help information""" help_text = """ ❓ Help & Support