diff --git a/package.json b/package.json index d11d176..2a95175 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffinbot", - "version": "4.0.0-pudding.d240929a", + "version": "4.0.0-pudding.d240930a", "main": "dist/index.js", "private": true, "dependencies": { @@ -15,8 +15,7 @@ "dokdo": "^1.0.1", "dotenv": "^16.4.5", "mysql2": "^3.11.3", - "semver": "^7.6.3", - "undici": "^6.19.8" + "semver": "^7.6.3" }, "devDependencies": { "@eslint/eslintrc": "^3.1.0", diff --git a/src/Commands/deleteLearn.ts b/src/Commands/deleteLearn.ts index 938f4c6..36a321f 100644 --- a/src/Commands/deleteLearn.ts +++ b/src/Commands/deleteLearn.ts @@ -40,7 +40,7 @@ class DeleteLearnCommand extends Command { }, }) - if (!deleteDatas) { + if (deleteDatas.length === 0) { return await msg.reply('해당하는 걸 찾ㅈ을 수 없어요.') } @@ -70,7 +70,14 @@ class DeleteLearnCommand extends Command { type: ComponentType.StringSelect, customId: `${CUSTOM_ID}@${msg.author.id}`, placeholder: '지울 데이터를 선택해ㅈ주세요', - options, + options: [ + ...options, + { + label: '❌ 취소', + description: '아무것도 삭제하지 않아요.', + value: `${CUSTOM_ID}-cancel`, + }, + ], }, ], }, diff --git a/src/interaction-handlers/deleteLearn.ts b/src/interaction-handlers/deleteLearn.ts index 4152e74..9fff51e 100644 --- a/src/interaction-handlers/deleteLearn.ts +++ b/src/interaction-handlers/deleteLearn.ts @@ -32,6 +32,18 @@ class DeleteLearnHandler extends InteractionHandler { const db = this.container.database const decimalRegexp = /^[0-9]/g + if (id === 'cancel') + return interaction.editReply({ + embeds: [ + { + title: '삭제', + description: '아무것도 삭제하지 않았어요.', + color: 0x00ff00, + }, + ], + components: [], + }) + const itemId = interaction.component.options.map(item => item.value.endsWith(`${id}`) ? item.label.match(decimalRegexp)![0] : null, ) @@ -46,7 +58,7 @@ class DeleteLearnHandler extends InteractionHandler { embeds: [ { title: '삭제', - description: `${Number(itemId!)}번을 정상적으로 삭제하ㅇ였어요.`, + description: `${Number(itemId[0]!)}번을 정상적으로 삭제하ㅇ였어요.`, timestamp: new Date().toISOString(), color: this.container.embedColor, }, diff --git a/yarn.lock b/yarn.lock index 59263e8..c942e86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2927,7 +2927,6 @@ __metadata: semver: "npm:^7.6.3" tsup: "npm:^8.3.0" typescript: "npm:^5.6.2" - undici: "npm:^6.19.8" languageName: unknown linkType: soft @@ -3909,7 +3908,7 @@ __metadata: languageName: node linkType: hard -"undici@npm:6.19.8, undici@npm:^6.19.8": +"undici@npm:6.19.8": version: 6.19.8 resolution: "undici@npm:6.19.8" checksum: 10c0/07fd8520bce7e34ea29c07ef0de27b734183042cdb4e2f1262cd1fb9b755a6b04ff2471040395dfb1770fb7786069a97c5178bcf706b80a34075994f46feb37c