feat: modernize and harden bot deployment

This commit is contained in:
2026-08-13 18:31:06 +09:00
parent 09ccb03626
commit 061dbf0f3f
18 changed files with 698 additions and 1702 deletions
+85 -72
View File
@@ -1,83 +1,96 @@
import { SlashCommandBuilder, SlashCommandSubcommandBuilder } from '@discordjs/builders';
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')
.setRequired(true));
const channels = new SlashCommandSubcommandBuilder()
.setName('channels')
.setDescription('Configure channel list')
.addStringOption(option =>
option.setName('add_remove')
.setDescription('add_remove')
.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)
.addChoices(
{ name: 'Add', value: 'add' },
{ name: 'Remove', value: 'remove' }
))
.addChannelOption(option =>
option.setName('channel')
.setDescription('The channel to list')
.setRequired(true));
const channels_type = new SlashCommandSubcommandBuilder()
.setName('channels_type')
.setDescription('Set the channel list type')
.addStringOption(option =>
option.setName('channels_type')
.setDescription('include or exclude')
.setRequired(true)
.addChoices(
{ name: 'Include', value: 'include' },
{ name: 'Exclude', value: 'exclude' }
));
const emojis = new SlashCommandSubcommandBuilder()
.setName('emojis')
.setDescription('Configure emoji list')
.addStringOption(option =>
option.setName('add_remove')
.setDescription('add_remove')
.setRequired(true)
.addChoices(
{ name: 'Add', value: 'add' },
{ name: 'Remove', value: 'remove' }
))
.addStringOption(option =>
option.setName('emoji')
.setDescription('The emoji to list')
.setRequired(true));
const emojis_type = new SlashCommandSubcommandBuilder()
.setName('emojis_type')
.setDescription('Set the emoji list type')
.addStringOption(option =>
option.setName('emojis_type')
.setDescription('include or exclude')
.setRequired(true)
.addChoices(
{ name: 'Include', value: 'include' },
{ name: 'Exclude', value: 'exclude' }
));
const score = new SlashCommandSubcommandBuilder()
.setName('score')
.setDescription('Set the number of scores to trigger')
.addIntegerOption(option =>
option.setName('score')
.setDescription('The number of scores to trigger')
.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')
.setName("config")
.setDescription("Configure the bot")
.setDMPermission(false)
.addSubcommand(output)
.addSubcommand(channels)
.addSubcommand(channels_type)
.addSubcommand(channelsType)
.addSubcommand(emojis)
.addSubcommand(emojis_type)
.addSubcommand(emojisType)
.addSubcommand(score);
const commands = [config];
export default commands;
export default [config];