| import logging |
| import os |
| from telegram import Update, WebAppInfo, InlineKeyboardButton, InlineKeyboardMarkup |
| from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler |
|
|
| |
| logging.basicConfig( |
| format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO |
| ) |
|
|
| |
| TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN", "YOUR_BOT_TOKEN") |
| WEB_APP_URL = os.getenv("WEB_APP_URL", "https://your-webapp-url.com") |
|
|
| async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): |
| keyboard = [ |
| [ |
| InlineKeyboardButton( |
| text="Open HCY Audio System", |
| web_app=WebAppInfo(url=WEB_APP_URL) |
| ) |
| ] |
| ] |
| reply_markup = InlineKeyboardMarkup(keyboard) |
| await update.message.reply_text( |
| "Welcome to HCY Audio System! Click the button below to open the Mini App.", |
| reply_markup=reply_markup |
| ) |
|
|
| def main(): |
| application = ApplicationBuilder().token(TELEGRAM_BOT_TOKEN).build() |
|
|
| application.add_handler(CommandHandler("start", start)) |
|
|
| application.run_polling() |
|
|
| if __name__ == "__main__": |
| main() |
|
|