File size: 958 Bytes
b519558
 
 
 
 
a1673c4
1ff776b
b519558
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()