Answer the question
In order to leave comments, you need to log in
How can a bot send a message to a user, knowing his id?
I am writing a bot on aiogram, and when I write the /number (user id) (number) command, the bot should answer me ready and write a message to the user whose id I entered in the /number command.
Everything works except sending a message to another user
@dp.message_handler(commands=['number'], user_id=my_chat_id)
async def number(message: types.Message):
conn = sqlite3.connect('db.db')
cur = conn.cursor()
currency, amount = message.text.split()[1:]
result = cur.execute("SELECT * FROM users WHERE user_id = ?", (currency, )).fetchone()
number = result[12]
cur.execute("UPDATE users SET number = number + ? WHERE user_id = ?", (amount, currency))
conn.commit()
await message.reply('Готово')
await message.answer(f'Вы получили {amount} монет', user_id=currency) #не работает
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question