If you do not have a solid understanding of JavaScript or how it works and wish to learn how to do this; I suggest that you read some guides! There are some I have linked below.
Editing a sent message
There are loads of ways we can go around doing this, but let's start with one of the simplest (using a .then() block) :
The code above will send a message saying Beep and then quickly edit it to Boop!.
Remember, you can do anything with the sentMessage variable.
Using async / await
Anywhere inside an async function, you can use the operator await.
Quick Definition: await is used to wait for the promise to either be accepted or rejected. Basically, await is used to make sure something happens after the thing(s) before it have been executed.
Implementation of async / await
Alright, let's get down to some code, eh?
const msg = await message.channel.send("Beep");
msg.edit("Boop");
// you can do whatever you want with the msg variable; it returns the normal message object.
msg.react("👋")
Here, we do const msg = await message.channel.send("Beep"). What this does is it sends a message saying "Beep" (making sure that everything else before it has been completed) and storing it as a variable msg.
@static2020 I'll send a friend request (I'm at school so I can't right now but will do later). As for discord bot dev I'm pretty much dead right now, but I'll be sure to look into it.
Edit a message - Discord.js Bot Development
Editing Messages | Discord.js
If you do not have a solid understanding of JavaScript or how it works and wish to learn how to do this; I suggest that you read some guides! There are some I have linked below.
Editing a sent message
There are loads of ways we can go around doing this, but let's start with one of the simplest (using a
.then()
block) :The code above will send a message saying
Beep
and then quickly edit it toBoop!
.Remember, you can do anything with the
sentMessage
variable.Using
async
/await
Anywhere inside an
async
function, you can use the operatorawait
.Quick Definition:
await
is used to wait for the promise to either be accepted or rejected. Basically,await
is used to make sure something happens after the thing(s) before it have been executed.Implementation of
async
/await
Alright, let's get down to some code, eh?
Here, we do
const msg = await message.channel.send("Beep")
. What this does is it sends a message saying "Beep" (making sure that everything else before it has been completed) and storing it as a variablemsg
.Refer to the Official Discord.js Guide website for further resources
@static2020 I'll send a friend request (I'm at school so I can't right now but will do later). As for discord bot dev I'm pretty much dead right now, but I'll be sure to look into it.