Closed aboaymn closed 3 months ago
from telegram import Update from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
TOKEN = "7376417548:AAFUgZlIIFLJu2SCnAHVhE6JSB2aLNRr3xQ"
def start(update: Update, context: CallbackContext) -> None: update.message.reply_text("Hello! I am an automatic reply bot. Send me any message, and I'll respond with the same text.")
def echo(update: Update, context: CallbackContext) -> None: update.message.reply_text(update.message.text)
def main() -> None: updater = Updater(TOKEN) dispatcher = updater.dispatcher
# Add /start command handler dispatcher.add_handler(CommandHandler("start", start))
# Add message handler dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, echo))
# Start the bot updater.start_polling()
# Keep the bot alive until manually stopped updater.idle()
if name == "main": main() #1869
from telegram import Update from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
Replace "YOUR_BOT_TOKEN" with your bot's token
TOKEN = "7376417548:AAFUgZlIIFLJu2SCnAHVhE6JSB2aLNRr3xQ"
def start(update: Update, context: CallbackContext) -> None: update.message.reply_text("Hello! I am an automatic reply bot. Send me any message, and I'll respond with the same text.")
def echo(update: Update, context: CallbackContext) -> None: update.message.reply_text(update.message.text)
def main() -> None: updater = Updater(TOKEN) dispatcher = updater.dispatcher
# Add /start command handler dispatcher.add_handler(CommandHandler("start", start))
# Add message handler dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, echo))
# Start the bot updater.start_polling()
# Keep the bot alive until manually stopped updater.idle()
if name == "main": main() #1869