feat: Add deleteLearn's cancel
This commit is contained in:
parent
ed782a7b96
commit
789bfba759
3 changed files with 22 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "muffinbot",
|
"name": "muffinbot",
|
||||||
"version": "3.1.0-cake.r240928a",
|
"version": "3.2.0-cake.r240930a",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -69,7 +69,14 @@ class DeleteLearnCommand extends Command {
|
||||||
type: ComponentType.StringSelect,
|
type: ComponentType.StringSelect,
|
||||||
customId: `${CUSTOM_ID}@${msg.author.id}`,
|
customId: `${CUSTOM_ID}@${msg.author.id}`,
|
||||||
placeholder: '지울 데이터를 선택해ㅈ주세요',
|
placeholder: '지울 데이터를 선택해ㅈ주세요',
|
||||||
options,
|
options: [
|
||||||
|
...options,
|
||||||
|
{
|
||||||
|
label: '❌ 취소',
|
||||||
|
description: '아무것도 삭제하지 않아요.',
|
||||||
|
value: `${CUSTOM_ID}-cancel`,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,6 +32,18 @@ class DeleteLearnHandler extends InteractionHandler {
|
||||||
const db = this.container.database
|
const db = this.container.database
|
||||||
const decimalRegexp = /^[0-9]/g
|
const decimalRegexp = /^[0-9]/g
|
||||||
|
|
||||||
|
if (id === 'cancel')
|
||||||
|
return interaction.editReply({
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
title: '삭제',
|
||||||
|
description: '아무것도 삭제하지 않았어요.',
|
||||||
|
color: 0x00ff00,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
components: [],
|
||||||
|
})
|
||||||
|
|
||||||
const itemId = interaction.component.options.map(item =>
|
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,
|
||||||
)
|
)
|
||||||
|
@ -42,7 +54,7 @@ class DeleteLearnHandler extends InteractionHandler {
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: '삭제',
|
title: '삭제',
|
||||||
description: `${Number(itemId!)}번을 정상적으로 삭제하ㅇ였어요.`,
|
description: `${Number(itemId[0]!)}번을 정상적으로 삭제하ㅇ였어요.`,
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue