1
votes

I've created a Discord bot that can do a countdown timer. Now I want it to be able to send an embed message to the channel and as the timer counts down I want the bot to edit the original message to say something different without sending another message to the channel. It currently will send a new message every time as it counts down.

Current Style:

Game starts in 1 minute

Game starts in 30 seconds

0 - Game Starting!

Wanted Style: Game starts in 1 minute <-- Then edit that message to say Game starts in 30 seconds

1

1 Answers

1
votes

So, what you basically want to do is Editing the Message. That is possible using <Message>.edit() method of the message. So what you'll want to do is kinda like this. (You can check the docs here)

const msg = await message.channel.send("Game starts in 1 min");

// Then use msg.edit instead of message.channel.send for the new message

await msg.edit("Game starts in 30 seconds");

Remember that you need to use this in an async function, since we are using await message.channel.send and await msg.edit.