import { Client, GatewayIntentBits } from "discord.js";
import { Knub, guildPlugin, guildPluginSlashCommand, slashOptions } from "knub";
const echoCommand = guildPluginSlashCommand({
name: "echo",
description: "Repeats what you say",
signature: [
slashOptions.string({ name: "text", description: "The text to repeat", required: true }),
],
run({ interaction, options }) {
interaction.reply(options.text);
},
});
const myPlugin = guildPlugin({
name: "my-plugin",
configParser: () => ({}),
slashCommands: [
echoCommand,
],
});
const djsClient = new Client({
intents: [
GatewayIntentBits.Guilds,
],
});
const knub = new Knub(djsClient, {
guildPlugins: [
myPlugin,
],
});
knub.initialize();
djsClient.login("YOUR TOKEN HERE");