|
|
import os |
|
|
from telegram import Update |
|
|
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext |
|
|
|
|
|
|
|
|
TOKEN = "7465639568:AAGX2th7mPd-_Ih1J4JLOZ-MzUDDBuce2Ss" |
|
|
|
|
|
def start(update: Update, context: CallbackContext): |
|
|
update.message.reply_text("Hello! I'm a test bot hosted on Hugging Face Spaces!") |
|
|
|
|
|
def echo(update: Update, context: CallbackContext): |
|
|
update.message.reply_text(f"You said: {update.message.text}") |
|
|
|
|
|
def main(): |
|
|
|
|
|
updater = Updater(TOKEN, use_context=True) |
|
|
dispatcher = updater.dispatcher |
|
|
|
|
|
|
|
|
dispatcher.add_handler(CommandHandler("start", start)) |
|
|
dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, echo)) |
|
|
|
|
|
|
|
|
updater.start_polling() |
|
|
updater.idle() |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |