From 8712eb4f58074b78a2c47a7770e29f5b57d1afab Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Sun, 16 Mar 2025 19:54:54 +0900 Subject: [PATCH] chore: Seperating command categorys (generals, chattings) --- .../{ => chattings}/deleteLearnedData.ts | 6 ++--- src/commands/{ => chattings}/learn.ts | 4 ++-- .../{ => chattings}/learnedDataList.ts | 4 ++-- src/commands/{ => generals}/dataLength.ts | 4 ++-- src/commands/generals/help.ts | 23 +++++++++++++++++++ src/commands/{ => generals}/information.ts | 2 +- src/commands/help.ts | 20 ---------------- src/lib/commandCategory.ts | 11 +++++++++ 8 files changed, 44 insertions(+), 30 deletions(-) rename src/commands/{ => chattings}/deleteLearnedData.ts (96%) rename src/commands/{ => chattings}/learn.ts (98%) rename src/commands/{ => chattings}/learnedDataList.ts (95%) rename src/commands/{ => generals}/dataLength.ts (96%) create mode 100644 src/commands/generals/help.ts rename src/commands/{ => generals}/information.ts (97%) delete mode 100644 src/commands/help.ts create mode 100644 src/lib/commandCategory.ts diff --git a/src/commands/deleteLearnedData.ts b/src/commands/chattings/deleteLearnedData.ts similarity index 96% rename from src/commands/deleteLearnedData.ts rename to src/commands/chattings/deleteLearnedData.ts index bf0539b..6904da9 100644 --- a/src/commands/deleteLearnedData.ts +++ b/src/commands/chattings/deleteLearnedData.ts @@ -1,6 +1,6 @@ -import type { Context } from '../lib/context' -import { MuffinCustomId } from '../lib/customId' -import { Learn } from '../lib/databases' +import type { Context } from '../../lib/context' +import { MuffinCustomId } from '../../lib/customId' +import { Learn } from '../../lib/databases' import { ApplyOptions } from '@sapphire/decorators' import { Args, Command } from '@sapphire/framework' import { diff --git a/src/commands/learn.ts b/src/commands/chattings/learn.ts similarity index 98% rename from src/commands/learn.ts rename to src/commands/chattings/learn.ts index 4890846..dc11a2e 100644 --- a/src/commands/learn.ts +++ b/src/commands/chattings/learn.ts @@ -1,5 +1,5 @@ -import type { Context } from '../lib/context' -import { Learn } from '../lib/databases' +import type { Context } from '../../lib/context' +import { Learn } from '../../lib/databases' import { ApplyOptions } from '@sapphire/decorators' import { Args, Command } from '@sapphire/framework' import { diff --git a/src/commands/learnedDataList.ts b/src/commands/chattings/learnedDataList.ts similarity index 95% rename from src/commands/learnedDataList.ts rename to src/commands/chattings/learnedDataList.ts index fbe22ce..592024d 100644 --- a/src/commands/learnedDataList.ts +++ b/src/commands/chattings/learnedDataList.ts @@ -1,5 +1,5 @@ -import type { Context } from '../lib/context' -import { Learn } from '../lib/databases' +import type { Context } from '../../lib/context' +import { Learn } from '../../lib/databases' import { ApplyOptions } from '@sapphire/decorators' import { Command } from '@sapphire/framework' import { diff --git a/src/commands/dataLength.ts b/src/commands/generals/dataLength.ts similarity index 96% rename from src/commands/dataLength.ts rename to src/commands/generals/dataLength.ts index 2719f38..26c2b2a 100644 --- a/src/commands/dataLength.ts +++ b/src/commands/generals/dataLength.ts @@ -1,5 +1,5 @@ -import type { Context } from '../lib/context' -import { Learn, Text } from '../lib/databases' +import type { Context } from '../../lib/context' +import { Learn, Text } from '../../lib/databases' import { ApplyOptions } from '@sapphire/decorators' import { Command } from '@sapphire/framework' import { diff --git a/src/commands/generals/help.ts b/src/commands/generals/help.ts new file mode 100644 index 0000000..261f3a3 --- /dev/null +++ b/src/commands/generals/help.ts @@ -0,0 +1,23 @@ +import type { Context } from '../../lib/context' +import { ApplyOptions } from '@sapphire/decorators' +import { Args, Command } from '@sapphire/framework' +import type { ChatInputCommandInteraction, Message } from 'discord.js' + +@ApplyOptions({ + name: '도움말', + aliases: ['도움', '명령어', 'help'], + description: '기본적인 사용ㅂ법이에요.', +}) +export default class HelpCommand extends Command { + public async messageRun(msg: Message, args: Args) { + return await this._run(msg, args) + } + + public async chatInputRun( + interaction: ChatInputCommandInteraction<'cached'>, + ) { + return await this._run(interaction) + } + + private async _run(ctx: Context, args?: Args) {} +} diff --git a/src/commands/information.ts b/src/commands/generals/information.ts similarity index 97% rename from src/commands/information.ts rename to src/commands/generals/information.ts index e1c3c9a..7d2d175 100644 --- a/src/commands/information.ts +++ b/src/commands/generals/information.ts @@ -1,4 +1,4 @@ -import type { Context } from '../lib/context' +import type { Context } from '../../lib/context' import { ApplyOptions } from '@sapphire/decorators' import { Command } from '@sapphire/framework' import { diff --git a/src/commands/help.ts b/src/commands/help.ts deleted file mode 100644 index 2b8e97c..0000000 --- a/src/commands/help.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ApplyOptions } from '@sapphire/decorators' -import { Command } from '@sapphire/framework' -import type { ChatInputCommandInteraction, Message } from 'discord.js' - -@ApplyOptions({ - name: '도움말', - aliases: ['도움', '명령어', 'help'], - description: '기본적인 사용ㅂ법이에요.', -}) -export default class HelpCommand extends Command { - private async _run( - ctx: Message | ChatInputCommandInteraction<'cached'>, - ) { - ctx.reply('현재 준ㅂ비중') - } - - public async messageRun(message: Message) { - await this._run(message) - } -} diff --git a/src/lib/commandCategory.ts b/src/lib/commandCategory.ts new file mode 100644 index 0000000..18ea9da --- /dev/null +++ b/src/lib/commandCategory.ts @@ -0,0 +1,11 @@ +export type Category = '일반' | '채팅' +export type CategoryByEnglish = 'generals' | 'chattings' + +export function getCategory(category: CategoryByEnglish): Category { + switch (category) { + case 'generals': + return '일반' + case 'chattings': + return '채팅' + } +}