Stbemu Codes And Xtream Codes - Telegram Channel Page

# docker-compose.yml version: '3.8'

def assign_code_to_user(self, telegram_id, code_type, code_id, expires_in_hours=24): expires_at = datetime.now() + timedelta(hours=expires_in_hours) cursor = self.conn.cursor() cursor.execute(''' INSERT INTO user_requests (telegram_id, code_type, assigned_code_id, expires_at) VALUES (?, ?, ?, ?) ''', (telegram_id, code_type, code_id, expires_at)) self.conn.commit() Stbemu Codes and Xtream Codes - Telegram channel

try: args = context.args if len(args) < 4: await update.message.reply_text( "Usage: /add_xtream <server_url> <username> <password> <expiry_days>" ) return server_url, username, password, days = args[0], args[1], args[2], int(args[3]) code_id = db.add_xtream_code(server_url, username, password, 1, days) await update.message.reply_text( f"✅ Xtream code added successfully!\n" f"ID: {code_id}\n" f"Valid for: {days} days" ) except Exception as e: await update.message.reply_text(f"❌ Error: {str(e)}") async def add_stbemu(update: Update, context: ContextTypes.DEFAULT_TYPE): """Admin: Add new STBEmu code (format: /add_stbemu mac server_url portal_name days)""" if update.effective_user.id not in ADMIN_IDS: await update.message.reply_text("⛔ Admin only command!") return # docker-compose

def get_user_active_codes(self, telegram_id): cursor = self.conn.cursor() cursor.execute(''' SELECT code_type, assigned_code_id, expires_at FROM user_requests WHERE telegram_id = ? AND status = 'active' AND expires_at > ? ''', (telegram_id, datetime.now())) return cursor.fetchall() # bot.py import os import re import logging from datetime import datetime from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram.ext import ( Application, CommandHandler, CallbackQueryHandler, MessageHandler, filters, ContextTypes ) from database import Database Configuration TOKEN = os.getenv("TELEGRAM_BOT_TOKEN") ADMIN_IDS = [123456789, 987654321] # Add your admin IDs Initialize database db = Database() Setup logging logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO ) logger = logging.getLogger( name ) Validators def validate_mac_address(mac): """Validate MAC address format (00:1A:79:XX:XX:XX)""" pattern = r'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$' return re.match(pattern, mac) is not None expires_at) VALUES (?