diff --git a/package.json b/package.json index dd9ebab..d388c0f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "muffinbot", - "version": "4.0.0-pudding.e241008b.change_build_system_and_package_manager", - "main": "dist/index.js", + "version": "4.0.0-pudding.e241008c.change_build_system_and_package_manager", + "main": "dist/src/index.js", "private": true, "dependencies": { "@prisma/client": "^5.20.0", diff --git a/src/client.ts b/src/client.ts index 0e7102b..c04820f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -7,11 +7,6 @@ import semver from 'semver' const config = new Config() -// Load pieces -import './interaction-handlers/_load' -import './listeners/_load' -import './commands/_load' - const release = version .slice((semver.coerce(version)?.toString() + '-').length) .split('.')[1] @@ -58,7 +53,6 @@ export default class MuffinBot extends SapphireClient { repliedUser: true, }, partials: [Partials.Message, Partials.ThreadMember], - baseUserDirectory: null, }) } diff --git a/src/commands/_load.ts b/src/commands/_load.ts deleted file mode 100644 index 9780751..0000000 --- a/src/commands/_load.ts +++ /dev/null @@ -1,6 +0,0 @@ -import './deleteLearn' -import './information' -import './learnedData' -import './learn' -import './help' -import './list' diff --git a/src/commands/deleteLearn.ts b/src/commands/deleteLearn.ts index 1c1db79..9a08e87 100644 --- a/src/commands/deleteLearn.ts +++ b/src/commands/deleteLearn.ts @@ -8,10 +8,9 @@ import { Message, } from 'discord.js' import { - Args, - Command, - container, DetailedDescriptionCommandObject, + Command, + Args, } from '@sapphire/framework' @ApplyOptions({ @@ -23,7 +22,7 @@ import { examples: ['머핀아 삭제 머핀'], }, }) -class DeleteLearnCommand extends Command { +export default class DeleteLearnCommand extends Command { public registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand(builder => builder @@ -124,9 +123,3 @@ class DeleteLearnCommand extends Command { await this._run(interaction) } } - -void container.stores.loadPiece({ - piece: DeleteLearnCommand, - name: 'delete', - store: 'commands', -}) diff --git a/src/commands/help.ts b/src/commands/help.ts index 02a2ced..120cb6d 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -1,5 +1,5 @@ -import { Args, Command, container } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' +import { Args, Command } from '@sapphire/framework' import { type ChatInputCommandInteraction, codeBlock, @@ -15,7 +15,7 @@ import { examples: ['머핀아 도움말', '머핀아 도움말 배워'], }, }) -class HelpCommand extends Command { +export default class HelpCommand extends Command { public registerApplicationCommands(registry: Command.Registry) { const commands = this.container.stores.get('commands').map(command => { return { @@ -124,9 +124,3 @@ class HelpCommand extends Command { await this._run(interaction) } } - -void container.stores.loadPiece({ - piece: HelpCommand, - name: 'help', - store: 'commands', -}) diff --git a/src/commands/information.ts b/src/commands/information.ts index c28e27d..f761d26 100644 --- a/src/commands/information.ts +++ b/src/commands/information.ts @@ -1,6 +1,6 @@ import type { ChatInputCommandInteraction, Message } from 'discord.js' -import { Command, container } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' +import { Command } from '@sapphire/framework' import { platform, arch } from 'os' @ApplyOptions({ @@ -10,7 +10,7 @@ import { platform, arch } from 'os' usage: '머핀아 정보', }, }) -class InformationCommand extends Command { +export default class InformationCommand extends Command { public registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand(builder => builder.setName(this.name).setDescription(this.description), @@ -74,9 +74,3 @@ class InformationCommand extends Command { await this._run(interaction) } } - -void container.stores.loadPiece({ - piece: InformationCommand, - name: 'information', - store: 'commands', -}) diff --git a/src/commands/learn.ts b/src/commands/learn.ts index 3946505..94ff0d3 100644 --- a/src/commands/learn.ts +++ b/src/commands/learn.ts @@ -1,5 +1,5 @@ import { ChatInputCommandInteraction, codeBlock, Message } from 'discord.js' -import { type Args, Command, container } from '@sapphire/framework' +import { type Args, Command } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' @ApplyOptions({ @@ -15,7 +15,7 @@ import { ApplyOptions } from '@sapphire/decorators' ], }, }) -class LearnCommand extends Command { +export default class LearnCommand extends Command { public registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand(builder => builder @@ -126,9 +126,3 @@ class LearnCommand extends Command { await this._run(interaction) } } - -void container.stores.loadPiece({ - piece: LearnCommand, - name: 'learn', - store: 'commands', -}) diff --git a/src/commands/learnedData.ts b/src/commands/learnedData.ts index d579876..08a3159 100644 --- a/src/commands/learnedData.ts +++ b/src/commands/learnedData.ts @@ -1,6 +1,6 @@ import { ChatInputCommandInteraction, Message } from 'discord.js' -import { Command, container } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' +import { Command } from '@sapphire/framework' @ApplyOptions({ name: '데이터학습량', @@ -10,7 +10,7 @@ import { ApplyOptions } from '@sapphire/decorators' usage: '머핀아 학습데이터량', }, }) -class LearnedDataCommand extends Command { +export default class LearnedDataCommand extends Command { public registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand(builder => builder.setName(this.name).setDescription(this.description), @@ -48,9 +48,3 @@ ${user.username}님이 가르쳐준 단어: ${userData.length}개`) await this._run(interaction) } } - -void container.stores.loadPiece({ - piece: LearnedDataCommand, - name: 'learnedData', - store: 'commands', -}) diff --git a/src/commands/list.ts b/src/commands/list.ts index 48efab8..e057bf7 100644 --- a/src/commands/list.ts +++ b/src/commands/list.ts @@ -1,6 +1,6 @@ import { ChatInputCommandInteraction, Message, codeBlock } from 'discord.js' -import { Command, container } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' +import { Command } from '@sapphire/framework' @ApplyOptions({ name: '리스트', @@ -10,7 +10,7 @@ import { ApplyOptions } from '@sapphire/decorators' usage: '머핀아 리스트', }, }) -class ListCommand extends Command { +export default class ListCommand extends Command { public registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand(builder => builder.setName(this.name).setDescription(this.description), @@ -63,9 +63,3 @@ class ListCommand extends Command { await this._run(interaction) } } - -void container.stores.loadPiece({ - piece: ListCommand, - name: 'list', - store: 'commands', -}) diff --git a/src/interaction-handlers/_load.ts b/src/interaction-handlers/_load.ts deleted file mode 100644 index 338146d..0000000 --- a/src/interaction-handlers/_load.ts +++ /dev/null @@ -1 +0,0 @@ -import './deleteLearn' diff --git a/src/interaction-handlers/deleteLearn.ts b/src/interaction-handlers/deleteLearn.ts index 1ad94e4..ebb8af9 100644 --- a/src/interaction-handlers/deleteLearn.ts +++ b/src/interaction-handlers/deleteLearn.ts @@ -1,15 +1,14 @@ -import { - container, - InteractionHandler, - InteractionHandlerTypes, -} from '@sapphire/framework' import { type StringSelectMenuInteraction } from 'discord.js' import { ApplyOptions } from '@sapphire/decorators' +import { + InteractionHandlerTypes, + InteractionHandler, +} from '@sapphire/framework' @ApplyOptions({ interactionHandlerType: InteractionHandlerTypes.SelectMenu, }) -class DeleteLearnHandler extends InteractionHandler { +export default class DeleteLearnHandler extends InteractionHandler { private readonly _CUSTOM_ID = 'maa$deleteLearn' public async parse(interaction: StringSelectMenuInteraction) { @@ -67,9 +66,3 @@ class DeleteLearnHandler extends InteractionHandler { }) } } - -void container.stores.loadPiece({ - piece: DeleteLearnHandler, - name: 'deleteLearn', - store: 'interaction-handlers', -}) diff --git a/src/listeners/_load.ts b/src/listeners/_load.ts deleted file mode 100644 index d63c6fb..0000000 --- a/src/listeners/_load.ts +++ /dev/null @@ -1,4 +0,0 @@ -import './interactionCreate' -import './messageCreate' -import './debug' -import './ready' diff --git a/src/listeners/debug.ts b/src/listeners/debug.ts index fcea723..d08ae52 100644 --- a/src/listeners/debug.ts +++ b/src/listeners/debug.ts @@ -1,13 +1,7 @@ -import { Listener, container } from '@sapphire/framework' +import { Listener } from '@sapphire/framework' -class DebugListener extends Listener { +export default class DebugListener extends Listener { public async run(debug: string) { this.container.logger.debug(`[MuffinBot] ${debug}`) } } - -void container.stores.loadPiece({ - piece: DebugListener, - name: 'debug', - store: 'listeners', -}) diff --git a/src/listeners/interactionCreate.ts b/src/listeners/interactionCreate.ts index 5cd22f6..355538b 100644 --- a/src/listeners/interactionCreate.ts +++ b/src/listeners/interactionCreate.ts @@ -1,8 +1,8 @@ -import { container, Listener } from '@sapphire/framework' import { ChatInputCommandInteraction } from 'discord.js' +import { Listener } from '@sapphire/framework' import { previewWarning } from '../modules' -class InteractionCreateListener extends Listener { +export default class InteractionCreateListener extends Listener { public async run(interaction: ChatInputCommandInteraction<'cached'>) { if (interaction.isChatInputCommand()) { if (this.container.channel !== 'RELEASE') @@ -10,9 +10,3 @@ class InteractionCreateListener extends Listener { } } } - -void container.stores.loadPiece({ - piece: InteractionCreateListener, - name: 'interactionCreate', - store: 'listeners' -}) diff --git a/src/listeners/messageCreate.ts b/src/listeners/messageCreate.ts index 96e1d51..495809c 100644 --- a/src/listeners/messageCreate.ts +++ b/src/listeners/messageCreate.ts @@ -1,9 +1,9 @@ -import { Listener, container } from '@sapphire/framework' -import { type Message } from 'discord.js' import { noPerm, previewWarning } from '../modules' +import { Listener } from '@sapphire/framework' +import { type Message } from 'discord.js' import { Client } from 'dokdo' -class MessageCreateListener extends Listener { +export default class MessageCreateListener extends Listener { public async run(msg: Message) { const prefix = this.container.prefix const dokdo = new Client(this.container.client, { @@ -32,9 +32,3 @@ class MessageCreateListener extends Listener { } } } - -void container.stores.loadPiece({ - piece: MessageCreateListener, - name: 'messageCreate', - store: 'listeners', -}) diff --git a/src/listeners/ready.ts b/src/listeners/ready.ts index 64bf632..01c8938 100644 --- a/src/listeners/ready.ts +++ b/src/listeners/ready.ts @@ -1,9 +1,9 @@ -import { container, Listener } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' import { ActivityType, Client } from 'discord.js' +import { Listener } from '@sapphire/framework' @ApplyOptions({ once: true }) -class ClientReadyListener extends Listener { +export default class ClientReadyListener extends Listener { public async run(client: Client) { function setStatus() { client.user.setActivity({ @@ -18,9 +18,3 @@ class ClientReadyListener extends Listener { this.container.logger.info(`[MuffinBot] 먹힐 준ㅂ비 완료`) } } - -void container.stores.loadPiece({ - piece: ClientReadyListener, - name: 'ready', - store: 'listeners', -})