How To Make A Discord Bot Edit A Dm Message?
I want to implement a simple database for my server on Discord so i need my bot to DM me and when a variable change his value, he edit the DM (using the ID of the message he sent m
Solution 1:
const User = client.users.cache.get("Your UserId");
if (!User.dmChannel) return console.log("No messages found.");
// Getting the message by ID
User.dmChannel.messages.fetch("MessageID").then(dmMessage => {
// Editing the message.
dmMessage.edit("I have an update!");
})
Solution 2:
i am getting the following error with the given answer:
readline.js:1147
throw err;
^
TypeError: Cannot read property 'dmChannel' of undefined
at C:\Users\Shankar\Desktop\bot\Disgd-hax\index.js:29:35
at Interface._onLine (readline.js:327:5)
at Interface._line (readline.js:658:8)
at Interface._ttyWrite (readline.js:1003:14)
at ReadStream.onkeypress (readline.js:205:10)
at ReadStream.emit (events.js:315:20)
at emitKeys (internal/readline/utils.js:335:14)
at emitKeys.next (<anonymous>)
at ReadStream.onData (readline.js:1137:36)
at ReadStream.emit (events.js:315:20)
Post a Comment for "How To Make A Discord Bot Edit A Dm Message?"