How do i make my bot respond to !hello
Read the docs for the library you are using
What library are you using?
discordjs, discordpy, jdm, eris etc?
I’m pretty sure that is discord.js
It’s actually Botkit for Discord.js, and not Discord.js.
Try
const Discord = require(‘discord.js’);
// create a new Discord client
const config = require(’./config.json’);
const client = new Discord.Client();
bot.on(‘ready’, () =>{
Tags.sync();
console.log(‘Online’);
bot.user.setActivity(‘Piggy [Alpha] CHAPTER 12!’, { type: ‘PLAYING’}).catch(console.error);
});
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
client.on(‘message’, message => {
if (message.content.startsWith($prefix}hi
)) {
const embed = new RichEmbed()
.setTitle("Hi ! Hope your having a good time! ")
.setColor(0xFF0000)
.setDescription("Make sure to use the !help to get access to the commands");
message.author.send(embed);
} else if // your other commands
client.login(your-token
)
config.json file :
{
"prefix": "prefix here",
"token": "token here"
}
@DaRealMiniToon, next time you send code in this forum, can you please wrap it in back-ticks (```) so that the code is readable, like this:
will become
console.log("wrap your code in backticks");
It makes reading of the code easier for other support users!
hi okay I realized!
Thank you so much for saying this, this makes the code 1000% easier to read.
All bot instances would need to be changed to client as that’s the name of your new client.