#
Basic Bot
TypeScript
import { Bot, Intents, Command, Event, OptionType, EventType } from 'discordkit';
const client = new Bot({
intents: [
Intents.Guilds
]
});
const helloCommand = new Command({
name: 'hello',
description: 'Greets the user.',
options: [
{
type: OptionType.User,
name: 'user',
description: 'Select a user.'
}
],
run: async (bot, interaction) => {
const user = interaction.options.getUser('user');
await interaction.reply({
content: `Hi ${user.username} :wave:! I'm ${bot.user.username}.`
});
}
});
client.addCommand(helloCommand);
const onReady = new Event({
name: 'ready',
type: EventType.Once,
run: bot => {
console.log('Logged in as ' + bot.user.username + '.');
}
});
client.addEvent(onReady);
client.init('super-secret-token');