F
F
From Prog2021-07-07 19:49:17
Python
From Prog, 2021-07-07 19:49:17

How to use the aiogram library to make the bot send a message to your id?

The code:

@mybot.message_handler()
async def echo(message: types.Message):
  await message.answer(message, chat_id = 627976213)

So it doesn't work, how can I check this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bl4ckm45k, 2021-07-07
@FromProg

method answerdoes not accept chat_id parameter
use

await mybot.bot.send_message(chat_id = 123, text=message.text)

if you pass parameters in order, it is not necessary to specify named parameters, you can do this:
await mybot.bot.send_message(627976213, message.text)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question