Reputation: 1
**index.js **
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
// When the client is ready, run this code (only once)
client.once(Events.ClientReady, c => {
console.log(`Ready! Logged in as ${c.user.tag}`);
});
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity("Menghancurkan Dunia");
})
// Log in to Discord with your client's token
client.login(token);
How to add auto respond from my basic bot
example :
Upvotes: -4
Views: 85
Reputation: 5
You can do it with the messageCreate
event.
client.on("messageCreate", (message) => {
if(message.toLowerCase().includes('hey')){
message.reply({ content: 'Hai' })
}
})
This if reacts on all messages which contains „hey“ whether written in upper or lower case.
Upvotes: -2