Spaces:
Paused
Paused
| from telegram import Update, KeyboardButton, ReplyKeyboardMarkup | |
| from telegram.ext import Application, CommandHandler, ContextTypes | |
| import os | |
| # Set your bot token and web app URL here | |
| BOT_TOKEN = os.getenv("BOT_TOKEN",) | |
| WEB_APP_URL = os.getenv("WEB_APP_URL", "https://xfasfadgagsg-miniwebapp.hf.space") # Replace with your actual Hugging Face Space URL | |
| async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): | |
| keyboard = [ | |
| [KeyboardButton("🎵 Open Music Player", web_app={"url": WEB_APP_URL})] | |
| ] | |
| reply_markup = ReplyKeyboardMarkup(keyboard, resize_keyboard=True) | |
| await update.message.reply_text( | |
| "Welcome! Tap below to open the music player:", | |
| reply_markup=reply_markup | |
| ) | |
| if __name__ == "__main__": | |
| app = Application.builder().token(BOT_TOKEN).build() | |
| app.add_handler(CommandHandler("start", start)) | |
| print("Bot is running. Send /start to your bot in Telegram.") | |
| app.run_polling() |