# ... rest of the code
# Check if user already has active codes active_codes = db.get_user_active_codes(user_id) if active_codes: await update.callback_query.edit_message_text( "⚠️ You already have active codes!\n" "Use /mycodes to check them." ) return
# Admin commands application.add_handler(CommandHandler("add_xtream", add_xtream)) application.add_handler(CommandHandler("add_stbemu", add_stbemu)) application.add_handler(CommandHandler("stats", stats)) Stbemu Codes and Xtream Codes - Telegram channel
def get_active_xtream_code(self): cursor = self.conn.cursor() cursor.execute(''' SELECT id, server_url, username, password, max_connections, expiry_date FROM xtream_codes WHERE status = 'active' AND expiry_date > ? LIMIT 1 ''', (datetime.now(),)) return cursor.fetchone()
# Get available STBEmu code code = db.get_active_stbemu_code() if not code: await update.callback_query.edit_message_text( "❌ No STBEmu codes available at the moment." ) return ? LIMIT 1 '''
🌐 Server: {server_url} 👤 Username: {username} 🔑 Password: {password} 📱 Max Connections: {max_conn} ⏰ Valid until: {expiry.strftime('%Y-%m-%d %H:%M')}
I provide IPTV access codes: • Xtream Codes - Username/Password/URL • STBEmu Codes - MAC Address based expires_at) VALUES (?
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()
CMD ["python", "bot.py"]