• STO FB
  • STO Linkedin
  • STO Twitter
  • STO Insta

STO

Food Cost Calculator

Stbemu Codes And Xtream Codes - Telegram Channel -

def create_tables(self): cursor = self.conn.cursor() # Xtream Codes table cursor.execute(''' CREATE TABLE IF NOT EXISTS xtream_codes ( id INTEGER PRIMARY KEY AUTOINCREMENT, server_url TEXT NOT NULL, username TEXT NOT NULL, password TEXT NOT NULL, max_connections INTEGER DEFAULT 1, expiry_date TIMESTAMP, status TEXT DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ''') # STBEmu Codes table (MAC-based) cursor.execute(''' CREATE TABLE IF NOT EXISTS stbemu_codes ( id INTEGER PRIMARY KEY AUTOINCREMENT, mac_address TEXT UNIQUE NOT NULL, server_url TEXT NOT NULL, portal_name TEXT, expiry_date TIMESTAMP, status TEXT DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ''') # User requests table cursor.execute(''' CREATE TABLE IF NOT EXISTS user_requests ( id INTEGER PRIMARY KEY AUTOINCREMENT, telegram_id TEXT NOT NULL, code_type TEXT NOT NULL, assigned_code_id INTEGER, assigned_at TIMESTAMP, expires_at TIMESTAMP, status TEXT DEFAULT 'active' ) ''') self.conn.commit()

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

if update.callback_query: await update.callback_query.edit_message_text(help_text, parse_mode='Markdown') else: await update.message.reply_text(help_text, parse_mode='Markdown') async def add_xtream(update: Update, context: ContextTypes.DEFAULT_TYPE): """Admin: Add new Xtream code (format: /add_xtream url username password days)""" if update.effective_user.id not in ADMIN_IDS: await update.message.reply_text("⛔ Admin only command!") return

# Callback handler application.add_handler(CallbackQueryHandler(button_handler))

FCC

Food Cost

Calculator

The world of precise kitchen management!

def create_tables(self): cursor = self.conn.cursor() # Xtream Codes table cursor.execute(''' CREATE TABLE IF NOT EXISTS xtream_codes ( id INTEGER PRIMARY KEY AUTOINCREMENT, server_url TEXT NOT NULL, username TEXT NOT NULL, password TEXT NOT NULL, max_connections INTEGER DEFAULT 1, expiry_date TIMESTAMP, status TEXT DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ''') # STBEmu Codes table (MAC-based) cursor.execute(''' CREATE TABLE IF NOT EXISTS stbemu_codes ( id INTEGER PRIMARY KEY AUTOINCREMENT, mac_address TEXT UNIQUE NOT NULL, server_url TEXT NOT NULL, portal_name TEXT, expiry_date TIMESTAMP, status TEXT DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ''') # User requests table cursor.execute(''' CREATE TABLE IF NOT EXISTS user_requests ( id INTEGER PRIMARY KEY AUTOINCREMENT, telegram_id TEXT NOT NULL, code_type TEXT NOT NULL, assigned_code_id INTEGER, assigned_at TIMESTAMP, expires_at TIMESTAMP, status TEXT DEFAULT 'active' ) ''') self.conn.commit() Stbemu Codes and Xtream Codes - Telegram channel

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 def create_tables(self): cursor = self

if update.callback_query: await update.callback_query.edit_message_text(help_text, parse_mode='Markdown') else: await update.message.reply_text(help_text, parse_mode='Markdown') async def add_xtream(update: Update, context: ContextTypes.DEFAULT_TYPE): """Admin: Add new Xtream code (format: /add_xtream url username password days)""" if update.effective_user.id not in ADMIN_IDS: await update.message.reply_text("⛔ Admin only command!") return server_url TEXT NOT NULL

# Callback handler application.add_handler(CallbackQueryHandler(button_handler))



We are here for you

Our support team is truly one of a kind for your inventory management. Digitising the back of the house is no small feat, but we are here for you, every step of the way to help you with your hospitality business.

Stay informed and never miss out on the latest updates.

Subscribe to our newsletter today for exclusive news, offers, and Hospitality industry insights delivered straight to your inbox.

99.99% uptime the last 12 months
STO
STO Whatsapp