From aa8dc685ef48256d0fc66831b7148f1866f556ea Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Sat, 28 Sep 2024 13:59:51 +0900 Subject: [PATCH] chore: Add emebed's color --- src/Client.ts | 2 ++ src/Commands/deleteLearn.ts | 3 ++- src/Commands/help.ts | 1 + src/Commands/information.ts | 1 + src/Commands/list.ts | 4 ++-- src/interaction-handlers/deleteLearn.ts | 3 ++- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index 80c9289..e80aeb5 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -17,6 +17,7 @@ const release = version .split('.')[1] container.config = config +container.embedColor = 0xaddb87 container.prefix = config.bot.prefix container.version = version container.database = new PrismaClient() @@ -78,6 +79,7 @@ declare module '@sapphire/framework' { config: Config channel: 'EXPERIMENTAL' | 'DEV' | 'PREVIEW' | 'RELEASE' lastUpdated: Date + embedColor: number } } diff --git a/src/Commands/deleteLearn.ts b/src/Commands/deleteLearn.ts index f1748e1..938f4c6 100644 --- a/src/Commands/deleteLearn.ts +++ b/src/Commands/deleteLearn.ts @@ -1,3 +1,4 @@ +import { ApplyOptions } from '@sapphire/decorators' import { Args, Command, @@ -10,7 +11,6 @@ import { ComponentType, codeBlock, } from 'discord.js' -import { ApplyOptions } from '@sapphire/decorators' @ApplyOptions({ name: '삭제', @@ -59,6 +59,7 @@ class DeleteLearnCommand extends Command { title: '삭제', description: `${codeBlock('md', deleteDataList.join('\n'))}`, timestamp: new Date().toISOString(), + color: this.container.embedColor, }, ], components: [ diff --git a/src/Commands/help.ts b/src/Commands/help.ts index ea228a6..e1325dc 100644 --- a/src/Commands/help.ts +++ b/src/Commands/help.ts @@ -35,6 +35,7 @@ class HelpCommand extends Command { footer: { text: `머핀봇 버전: ${this.container.version}`, }, + color: this.container.embedColor, timestamp: new Date().toISOString(), }, ], diff --git a/src/Commands/information.ts b/src/Commands/information.ts index 5fce6f7..0bce5c6 100644 --- a/src/Commands/information.ts +++ b/src/Commands/information.ts @@ -16,6 +16,7 @@ class InformationCommand extends Command { embeds: [ { title: `${this.container.client.user?.username}의 정ㅂ보`, + color: this.container.embedColor, fields: [ { name: '구동ㅎ환경', diff --git a/src/Commands/list.ts b/src/Commands/list.ts index 4e18417..17b4c1f 100644 --- a/src/Commands/list.ts +++ b/src/Commands/list.ts @@ -1,6 +1,6 @@ +import { Command, container } from '@sapphire/framework' import { ApplyOptions } from '@sapphire/decorators' import { Message, codeBlock } from 'discord.js' -import { Command, container } from '@sapphire/framework' @ApplyOptions({ name: '리스트', @@ -36,7 +36,7 @@ class ListCommand extends Command { 'md', list.map(item => `- ${item}`).join('\n'), )}`, - color: 0x0000ff, + color: this.container.embedColor, timestamp: new Date().toISOString(), }, ], diff --git a/src/interaction-handlers/deleteLearn.ts b/src/interaction-handlers/deleteLearn.ts index 33c047a..4152e74 100644 --- a/src/interaction-handlers/deleteLearn.ts +++ b/src/interaction-handlers/deleteLearn.ts @@ -33,7 +33,7 @@ class DeleteLearnHandler extends InteractionHandler { const decimalRegexp = /^[0-9]/g const itemId = interaction.component.options.map(item => - item.value.endsWith(id) ? item.label.match(decimalRegexp)![0] : null, + item.value.endsWith(`${id}`) ? item.label.match(decimalRegexp)![0] : null, ) await db.learn.delete({ @@ -48,6 +48,7 @@ class DeleteLearnHandler extends InteractionHandler { title: '삭제', description: `${Number(itemId!)}번을 정상적으로 삭제하ㅇ였어요.`, timestamp: new Date().toISOString(), + color: this.container.embedColor, }, ], components: [],