Reputation: 105
I have a code
client.once('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'say') {
if (!args.length) {
return message.channel.send('You didn\'t provide anything to say');
}
message.channel.send(`${args}`);
}
});
But if i run the say command once it stops working after that is there any way to fix it?
Upvotes: 2
Views: 1037
Reputation: 23161
.once()
only runs, well... once. You should use .on()
to listen to every incoming message:
client.on('message', message => {
//...
Upvotes: 5