Channel created
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, ContextTypes

# Токен вашего бота
TOKEN = 'YOUR_BOT_TOKEN'

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text("Привет! Я твой новый Telegram-бот.")

async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text("Используйте команду /start для начала разговора.")

async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text(f'Вы сказали: {update.message.text}')

def main():
    application = ApplicationBuilder().token(TOKEN).build()
   
    # Обработчики команд
    application.add_handler(CommandHandler('start', start))
    application.add_handler(CommandHandler('help', help_command))
   
    # Эхо-обработчик всех сообщений кроме тех, которые начинаются с '/'
    application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo))
   
    print("Bot is running...")
    application.run_polling()

if __name__ == '__main__':
    main()
This media is not supported in your browser
VIEW IN TELEGRAM
💻
Please open Telegram to view this post
VIEW IN TELEGRAM