When i send a message it repeat always

client.on(Events.MessageCreate , message => {
if (message.channel.id === channelid) {
const channel = client.channels.cache.get(channelid);
channel.send(message.content);
}

})
client.on(Events.MessageCreate , message => {
if (message.channel.id === channelid) {
const channel = client.channels.cache.get(channelid);
channel.send(message.content);
}

})
When I send a message it stays in an infinite loop sending the same message
3 Replies
d.js toolkit
d.js toolkit14mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs14mo ago
It's good practice to make your bots ignore other bots, including itself. This can be done through a single line of code:
if (<message>.author.bot) return;
if (<message>.author.bot) return;
<message> being whatever you defined message as.
vowxky
vowxkyOP14mo ago
Ty :))
Want results from more Discord servers?
Add your server