diff --git a/main.py b/main.py index 9600b17..a847ac3 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,13 @@ import logging from telegram import Update -from telegram.ext import ContextTypes, ApplicationBuilder, CommandHandler +from telegram.ext import ( + ContextTypes, + ApplicationBuilder, + CommandHandler, + MessageHandler, + filters, +) from settings import Settings @@ -20,9 +26,19 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): ) +async def message_handler(update: Update, context: ContextTypes.DEFAULT_TYPE): + await context.bot.send_message( + chat_id=update.effective_chat.id, + text="I'm sorry, I'm a bot and I can't understand that.", + ) + + if __name__ == "__main__": app = ApplicationBuilder().token(settings.bot_token).build() start_handler = CommandHandler("start", start) + message_handler = MessageHandler(filters.ALL, message_handler) + app.add_handler(start_handler) + app.add_handler(message_handler) app.run_polling()