Skip to content
Advertisement

Changing the content of a message sent by my bot in Discord

I use a slash command to create a channel, and in the channel, a message whose content is like this :

JavaScript

Then, the bot pins this message. All that works fine.

Now, I wanna use another command to change that content. Here is how I try to change the message’s content :

JavaScript

The “Message changed” is correct in the console, but is NOT changed in Discord. Why ?

Note : I tried $pinnedMsg->edit (I saw this in some answers about Discord.js and tried to adapt it to php) but it didn’t work : the following echo was not displayed.

Advertisement

Answer

Found the solution : you must call save on the messages list :

JavaScript

Not sure the done(…) after the save (…) is necessary, but it seems to be the syntax required. And, like this, it works.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement