From f0ed87bd8345094fd99f4c13f8f6ccfbb86bde5e Mon Sep 17 00:00:00 2001 From: yurisasc Date: Sat, 20 Jan 2024 03:06:52 +0700 Subject: [PATCH] feat: remove help command --- discord-bot/lang/lang.en-GB.json | 23 -------- discord-bot/lang/lang.en-US.json | 25 -------- discord-bot/src/commands/args.ts | 20 ------- discord-bot/src/commands/chat/help-command.ts | 59 ------------------- discord-bot/src/commands/chat/index.ts | 1 - discord-bot/src/start-bot.ts | 2 - 6 files changed, 130 deletions(-) delete mode 100644 discord-bot/src/commands/chat/help-command.ts diff --git a/discord-bot/lang/lang.en-GB.json b/discord-bot/lang/lang.en-GB.json index cbdd77f..d418814 100644 --- a/discord-bot/lang/lang.en-GB.json +++ b/discord-bot/lang/lang.en-GB.json @@ -1,20 +1,6 @@ { "data": { "displayEmbeds": { - "helpCommands": { - "title": "Help - {{REF:helpOptions.commands}}", - "fields": [ - { - "name": "Commands", - "value": [ - "To see the available commands, just type `/` and select the bot from the left side. You can then scroll through all available commands. Some commands may be hidden if you don't have permission to view them.", - "", - "{{CMD_LINK_START_SERVER}} - {{REF:commandDescs.startServer}}", - "{{CMD_LINK_STOP_SERVER}} - {{REF:commandDescs.stopServer}}" - ] - } - ] - }, "startServer": { "title": "🟡 Starting {{SERVER_NAME}}...", "description": "Please wait while the server starts. It may take up to 10 minutes." @@ -84,7 +70,6 @@ }, "refs": { "chatCommands": { - "help": "help", "startServer": "start", "stopServer": "stop" }, @@ -92,12 +77,10 @@ "option": "option" }, "commandDescs": { - "help": "Find help or contact support.", "startServer": "Start the minecraft server.", "stopServer": "Stop the minecraft server." }, "argDescs": { - "helpOption": "Option.", "startOption": "Server to start.", "stopOption": "Server to stop." }, @@ -147,12 +130,6 @@ "ViewChannel": "View Channel(s)", "ViewGuildInsights": "View Server Insights" }, - "helpOptions": { - "commands": "Commands" - }, - "helpOptionDescs": { - "commands": "{{REF:helpOptions.commands}} -- What commands are there? How do I restrict who is allowed to use commands?" - }, "yesNo": { "yes": "Yes", "no": "No" diff --git a/discord-bot/lang/lang.en-US.json b/discord-bot/lang/lang.en-US.json index 9542fad..d418814 100644 --- a/discord-bot/lang/lang.en-US.json +++ b/discord-bot/lang/lang.en-US.json @@ -1,20 +1,6 @@ { "data": { "displayEmbeds": { - "helpCommands": { - "title": "Help - {{REF:helpOptions.commands}}", - "fields": [ - { - "name": "Commands", - "value": [ - "To see the available commands, just type `/` and select the bot from the left side. You can then scroll through all available commands. Some commands may be hidden if you don't have permission to view them.", - "", - "{{CMD_LINK_START_SERVER}} - {{REF:commandDescs.startServer}}", - "{{CMD_LINK_STOP_SERVER}} - {{REF:commandDescs.stopServer}}" - ] - } - ] - }, "startServer": { "title": "🟡 Starting {{SERVER_NAME}}...", "description": "Please wait while the server starts. It may take up to 10 minutes." @@ -84,8 +70,6 @@ }, "refs": { "chatCommands": { - "help": "help", - "rlcraft": "rlcraft", "startServer": "start", "stopServer": "stop" }, @@ -93,13 +77,10 @@ "option": "option" }, "commandDescs": { - "help": "Find help or contact support.", - "rlcraft": "Commands for the RLcraft server.", "startServer": "Start the minecraft server.", "stopServer": "Stop the minecraft server." }, "argDescs": { - "helpOption": "Option.", "startOption": "Server to start.", "stopOption": "Server to stop." }, @@ -149,12 +130,6 @@ "ViewChannel": "View Channel(s)", "ViewGuildInsights": "View Server Insights" }, - "helpOptions": { - "commands": "Commands" - }, - "helpOptionDescs": { - "commands": "{{REF:helpOptions.commands}} -- What commands are there? How do I restrict who is allowed to use commands?" - }, "yesNo": { "yes": "Yes", "no": "No" diff --git a/discord-bot/src/commands/args.ts b/discord-bot/src/commands/args.ts index 1a83ed6..964645a 100644 --- a/discord-bot/src/commands/args.ts +++ b/discord-bot/src/commands/args.ts @@ -3,30 +3,10 @@ import { ApplicationCommandOptionType, } from "discord.js"; -import { HelpOption } from "../enums/help-option.js"; import { Language } from "../models/enum-helpers/language.js"; import { Lang } from "../services/index.js"; export class Args { - public static readonly HELP_OPTION: APIApplicationCommandBasicOption = { - name: Lang.getRef("arguments.option", Language.Default), - name_localizations: Lang.getRefLocalizationMap("arguments.option"), - description: Lang.getRef("argDescs.helpOption", Language.Default), - description_localizations: Lang.getRefLocalizationMap( - "argDescs.helpOption" - ), - type: ApplicationCommandOptionType.String, - choices: [ - { - name: Lang.getRef("helpOptionDescs.commands", Language.Default), - name_localizations: Lang.getRefLocalizationMap( - "helpOptionDescs.commands" - ), - value: HelpOption.COMMANDS, - }, - ], - }; - public static startOption( serverNames: string[] ): APIApplicationCommandBasicOption { diff --git a/discord-bot/src/commands/chat/help-command.ts b/discord-bot/src/commands/chat/help-command.ts deleted file mode 100644 index ecfe804..0000000 --- a/discord-bot/src/commands/chat/help-command.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { - ChatInputCommandInteraction, - EmbedBuilder, - PermissionsString, -} from "discord.js"; - -import { HelpOption } from "../../enums/help-option.js"; -import { Language } from "../../models/enum-helpers/language.js"; -import { EventData } from "../../models/internal-models.js"; -import { Lang } from "../../services/index.js"; -import { - ClientUtils, - FormatUtils, - InteractionUtils, -} from "../../utils/index.js"; -import { Command, CommandDeferType } from "../index.js"; - -export class HelpCommand implements Command { - public names = [Lang.getRef("chatCommands.help", Language.Default)]; - public deferType = CommandDeferType.PUBLIC; - public requireClientPerms: PermissionsString[] = []; - - public async execute( - intr: ChatInputCommandInteraction, - data: EventData - ): Promise { - let args = { - option: intr.options.getString( - Lang.getRef("arguments.option", Language.Default) - ) as HelpOption, - }; - - let embed: EmbedBuilder; - switch (args.option) { - case HelpOption.COMMANDS: { - embed = Lang.getEmbed("displayEmbeds.helpCommands", data.lang, { - CMD_LINK_START_SERVER: FormatUtils.commandMention( - await ClientUtils.findAppCommand( - intr.client, - Lang.getRef("chatCommands.startServer", Language.Default) - ) - ), - CMD_LINK_STOP_SERVER: FormatUtils.commandMention( - await ClientUtils.findAppCommand( - intr.client, - Lang.getRef("chatCommands.stopServer", Language.Default) - ) - ), - }); - break; - } - default: { - return; - } - } - - await InteractionUtils.send(intr, embed); - } -} diff --git a/discord-bot/src/commands/chat/index.ts b/discord-bot/src/commands/chat/index.ts index 8d03683..5a2ac67 100644 --- a/discord-bot/src/commands/chat/index.ts +++ b/discord-bot/src/commands/chat/index.ts @@ -1,3 +1,2 @@ export { StartServerCommand } from "./start-server-command.js"; export { StopServerCommand } from "./stop-server-command.js"; -export { HelpCommand } from "./help-command.js"; diff --git a/discord-bot/src/start-bot.ts b/discord-bot/src/start-bot.ts index 97406e9..f638288 100644 --- a/discord-bot/src/start-bot.ts +++ b/discord-bot/src/start-bot.ts @@ -10,7 +10,6 @@ dotenv.config({ }); import { - HelpCommand, StartServerCommand, StopServerCommand, } from "./commands/chat/index.js"; @@ -55,7 +54,6 @@ async function start(): Promise { // Commands let commands: Command[] = [ - new HelpCommand(), new StartServerCommand(multiServersService), new StopServerCommand(multiServersService), ];