import logging
from aiogram import Bot, Dispatcher, executor, types
API_TOKEN = '...'
# Configure logging
logging.basicConfig(level=logging.INFO)
# Initialize bot and dispatcher
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start', 'help'])
async def send_welcome(message: types.Message):
"""
This handler will be called when user sends `/start` or `/help` command
"""
await message.reply("Hi!nI'm EchoBot!nPowered by aiogram.")
@dp.message_handler()
async def echo(message: types.Message):
print(message)
# old style:
# await bot.send_message(message.chat.id, message.text)
await message.answer(message.text)
print('Bot started')
executor.start_polling(dp, skip_updates=True)
idk why my bot not working really, i’m trying to send message and without errors and did not get another indicators that something went wrong, just message in chat without reaction
2
Answers
Most likely you lack message.from_user.id, this is why the bot does not see the input message and does not react. I suggest that your code looks the following way:
i might be wrong