Compare commits
2 commits
d874273465
...
67fde66b9f
Author | SHA1 | Date | |
---|---|---|---|
67fde66b9f | |||
1e57b19a61 |
5 changed files with 326 additions and 296 deletions
30
package.json
30
package.json
|
@ -1,16 +1,16 @@
|
||||||
{
|
{
|
||||||
"name": "muffinbot",
|
"name": "muffinbot",
|
||||||
"version": "4.1.0-pudding.d241109a",
|
"version": "4.1.0-pudding.d241110a",
|
||||||
"main": "dist/src/index.js",
|
"main": "dist/src/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^5.20.0",
|
"@prisma/client": "^5.22.0",
|
||||||
"@sapphire/decorators": "^6.1.0",
|
"@sapphire/decorators": "^6.1.1",
|
||||||
"@sapphire/discord.js-utilities": "^7.3.0",
|
"@sapphire/discord.js-utilities": "^7.3.1",
|
||||||
"@sapphire/framework": "^5.2.1",
|
"@sapphire/framework": "^5.3.1",
|
||||||
"@sapphire/pieces": "^4.3.1",
|
"@sapphire/pieces": "^4.3.1",
|
||||||
"@sapphire/utilities": "^3.17.0",
|
"@sapphire/utilities": "^3.18.1",
|
||||||
"discord-api-types": "^0.37.101",
|
"discord-api-types": "^0.37.104",
|
||||||
"discord.js": "^14.16.3",
|
"discord.js": "^14.16.3",
|
||||||
"dokdo": "^1.0.1",
|
"dokdo": "^1.0.1",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
|
@ -18,21 +18,21 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.1.0",
|
"@eslint/eslintrc": "^3.1.0",
|
||||||
"@eslint/js": "^9.11.1",
|
"@eslint/js": "^9.14.0",
|
||||||
"@migan/prettier-config": "^1.2.0",
|
"@migan/prettier-config": "^1.2.0",
|
||||||
"@types/node": "^22.7.4",
|
"@types/node": "^22.9.0",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
||||||
"@typescript-eslint/parser": "^8.7.0",
|
"@typescript-eslint/parser": "^8.13.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^9.11.1",
|
"eslint": "^9.14.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"globals": "^15.9.0",
|
"globals": "^15.12.0",
|
||||||
"nodemon": "^3.1.7",
|
"nodemon": "^3.1.7",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"prisma": "^5.20.0",
|
"prisma": "^5.22.0",
|
||||||
"typescript": "^5.6.2"
|
"typescript": "^5.6.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|
528
pnpm-lock.yaml
528
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -6,6 +6,7 @@ import {
|
||||||
ComponentType,
|
ComponentType,
|
||||||
codeBlock,
|
codeBlock,
|
||||||
Message,
|
Message,
|
||||||
|
ButtonStyle,
|
||||||
} from 'discord.js'
|
} from 'discord.js'
|
||||||
import {
|
import {
|
||||||
DetailedDescriptionCommandObject,
|
DetailedDescriptionCommandObject,
|
||||||
|
@ -100,14 +101,18 @@ export default class DeleteLearnCommand extends Command {
|
||||||
type: ComponentType.StringSelect,
|
type: ComponentType.StringSelect,
|
||||||
customId: `${CUSTOM_ID}@${user.id}`,
|
customId: `${CUSTOM_ID}@${user.id}`,
|
||||||
placeholder: '지울 데이터를 선택해ㅈ주세요',
|
placeholder: '지울 데이터를 선택해ㅈ주세요',
|
||||||
options: [
|
options,
|
||||||
...options,
|
},
|
||||||
{
|
],
|
||||||
label: '❌ 취소',
|
},
|
||||||
description: '아무것도 삭제하지 않아요.',
|
{
|
||||||
value: `${CUSTOM_ID}-cancel`,
|
type: ComponentType.ActionRow,
|
||||||
},
|
components: [
|
||||||
],
|
{
|
||||||
|
type: ComponentType.Button,
|
||||||
|
customId: `${CUSTOM_ID}-cancel`,
|
||||||
|
label: '취소',
|
||||||
|
style: ButtonStyle.Danger,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,18 +31,6 @@ export default 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 await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: '삭제',
|
|
||||||
description: '아무것도 삭제하지 않았어요.',
|
|
||||||
color: this.container.embedColors.fail,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
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,
|
||||||
)
|
)
|
||||||
|
|
31
src/interaction-handlers/deleteLearnCancel.ts
Normal file
31
src/interaction-handlers/deleteLearnCancel.ts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import { ApplyOptions } from '@sapphire/decorators'
|
||||||
|
import {
|
||||||
|
InteractionHandler,
|
||||||
|
InteractionHandlerTypes,
|
||||||
|
} from '@sapphire/framework'
|
||||||
|
import { ButtonInteraction } from 'discord.js'
|
||||||
|
|
||||||
|
@ApplyOptions<InteractionHandler.Options>({
|
||||||
|
interactionHandlerType: InteractionHandlerTypes.Button,
|
||||||
|
})
|
||||||
|
export default class DeleteLearnCancelHandler extends InteractionHandler {
|
||||||
|
private _CUSTOM_ID = 'maa$deleteLearn'
|
||||||
|
|
||||||
|
public async parse(interaction: ButtonInteraction) {
|
||||||
|
if (interaction.customId !== `${this._CUSTOM_ID}-cancel`) return this.none()
|
||||||
|
return this.some()
|
||||||
|
}
|
||||||
|
|
||||||
|
public async run(interaction: ButtonInteraction) {
|
||||||
|
return await interaction.update({
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
title: '삭제',
|
||||||
|
description: '아무것도 삭제하지 않았어요.',
|
||||||
|
color: this.container.embedColors.fail,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
components: [],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue