R
R
RealSosiso4ka2021-10-29 20:21:56
Python
RealSosiso4ka, 2021-10-29 20:21:56

How to change private message by ID in discord.py?

I'm writing a command for a bot where the user enters values ​​and the bot enters them into the database (all this happens in a private chat with the bot). After the need to change the message by its ID, a problem arose. I can't find this message, which is actually logical, because in the code below I am trying to find it using the user variable, which is assigned the user value. How can I find this message?

My code (I know, the way I tried to find the message is complete nonsense):

user = bot.get_user(message_author_id) #получаем пользователя
for value in cur.execute("SELECT db_msg_id FROM {} WHERE userid == ?".format(name), (message_author_id,)).fetchone():
    msg_id = value #берём из базы данных айди сообщения, которое необходимо редактировать 
msg = user.fetch_message(msg_id) #эта строка не работает
await msg.edit(embed=embed)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question