Answer the question
In order to leave comments, you need to log in
How to make a !say command in a bot?
Please tell me the code for the !say command.
(!say [text])
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
client.on('message', msg => {
if (msg.content === '!say') {
const text = message.content.split(' ').slice(1).join(' ');
msg.reply(text);
}
});
const Discord = require("discord.js");
const pf = "!"; // your prefix
const bot = new Discord.Client();
bot.on('message', message => {
if (message.content === pf+'say') {
const text = message.content.split('|||').slice(1).join(' '); //
let gg = new Discord.RichEmbed()
.setDescription(text[0])
.setTitle(text[1])
.setColor("#ff5733")
message.channel.send(gg);
msg.react ('✅')
.then(console.log)
.catch(console.error);
}
}
});
bot.login("your bot's token")
there are a lot of errors ||| maybe it doesn't work...
https://discordjs.guide/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question