Files
discord-reaction-award/src/commands.ts
T

97 lines
2.8 KiB
TypeScript

import { ChannelType, SlashCommandBuilder, SlashCommandSubcommandBuilder } from "discord.js";
const output = new SlashCommandSubcommandBuilder()
.setName("output")
.setDescription("Set the output channel")
.addChannelOption((option) =>
option.setName("channel")
.setDescription("The channel to send messages to")
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
.setRequired(true)
);
const channels = new SlashCommandSubcommandBuilder()
.setName("channels")
.setDescription("Configure the channel list")
.addStringOption((option) =>
option.setName("action")
.setDescription("Add or remove the channel")
.setRequired(true)
.addChoices(
{ name: "Add", value: "add" },
{ name: "Remove", value: "remove" },
)
)
.addChannelOption((option) =>
option.setName("channel")
.setDescription("The channel to add or remove")
.setRequired(true)
);
const channelsType = new SlashCommandSubcommandBuilder()
.setName("channels_type")
.setDescription("Set the channel list type")
.addStringOption((option) =>
option.setName("type")
.setDescription("Use only listed channels, or ignore listed channels")
.setRequired(true)
.addChoices(
{ name: "Include", value: "include" },
{ name: "Exclude", value: "exclude" },
)
);
const emojis = new SlashCommandSubcommandBuilder()
.setName("emojis")
.setDescription("Configure the emoji list")
.addStringOption((option) =>
option.setName("action")
.setDescription("Add or remove the emoji")
.setRequired(true)
.addChoices(
{ name: "Add", value: "add" },
{ name: "Remove", value: "remove" },
)
)
.addStringOption((option) =>
option.setName("emoji")
.setDescription("Unicode emoji or custom emoji")
.setRequired(true)
);
const emojisType = new SlashCommandSubcommandBuilder()
.setName("emojis_type")
.setDescription("Set the emoji list type")
.addStringOption((option) =>
option.setName("type")
.setDescription("Use only listed emoji, or ignore listed emoji")
.setRequired(true)
.addChoices(
{ name: "Include", value: "include" },
{ name: "Exclude", value: "exclude" },
)
);
const score = new SlashCommandSubcommandBuilder()
.setName("score")
.setDescription("Set the score needed to award a message")
.addIntegerOption((option) =>
option.setName("score")
.setDescription("The score needed to award a message")
.setMinValue(1)
.setRequired(true)
);
const config = new SlashCommandBuilder()
.setName("config")
.setDescription("Configure the bot")
.setDMPermission(false)
.addSubcommand(output)
.addSubcommand(channels)
.addSubcommand(channelsType)
.addSubcommand(emojis)
.addSubcommand(emojisType)
.addSubcommand(score);
export default [config];