#Editing an message
1 messages ยท Page 1 of 1 (latest)
hi
^ @verbal monolith
ty guys
No problem
Could you send a snippet of the code you are using for editing the message
message.edit('This is my new content!')
.then(msg => console.log(`Updated the content of a message to ${msg.content}`))
.catch(console.error); ```
Messages are indexed by ids, im not sure if that helps.
Could you elaborate your question?
That helped
Thank you for asking
Ehmmmm.. Why does this not work? @fluid temple ๐
let id = message.id
console.log(id)
})
await.sleep(5000)
id.edit('This is my new content!')
.then(msg => console.log(`Updated the content of a message to ${msg.content}`))
.catch(console.error); ```
Alright, so firstly your bot has to send an message and then do .then(msg => {msg.edit()}) , right now there is no message to edit
Secondly, it's kind of with that but an message ID isn't an message object (which can be returned by handling the promise using .then)
Can u give me an example? ๐
ty
client.on('messageCreate', message => {
if(message.author.bot) return
message.reply('Example message').then(msg => {
msg.edit(options)
})
})```
@verbal monolith
Thank you very much! It is nice of you
No problem
But how can i make this work???
if(message.author.bot) return
message.reply('Example message').then(msg => {
setTimeout(10)
msg.edit('e')
})
}) ```
client.on('messageCreate', message => {
if(message.author.bot) return
message.reply('Example message').then(msg => {
setTimeout(function(){msg.edit(e)}, 10)
})
}) ```
ty