fix: It's dokdo command, but if use the message components, show forbidden by deleteLearnedData

This commit is contained in:
Siwoo Jeon 2025-03-09 11:50:14 +09:00
parent 4200f2a151
commit 528d7f09eb
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
3 changed files with 12 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import { Config } from './config' import { Config } from './config'
import { ReleaseChannel } from './lib/releaseChannel' import { ReleaseChannel } from './lib/releaseChannel'
import { container } from '@sapphire/pieces' import { container } from '@sapphire/pieces'
import type { Client } from 'dokdo'
import { connect, disconnect } from 'mongoose' import { connect, disconnect } from 'mongoose'
declare module '@sapphire/pieces' { declare module '@sapphire/pieces' {
@ -15,8 +16,8 @@ declare module '@sapphire/pieces' {
success: number success: number
} }
channel: ReleaseChannel channel: ReleaseChannel
}
dokdo: Client dokdo: Client
}
} }
declare module '@sapphire/framework' { declare module '@sapphire/framework' {
@ -29,7 +30,7 @@ declare module '@sapphire/framework' {
container.dbDisconnect = async () => await disconnect() container.dbDisconnect = async () => await disconnect()
container.config = new Config() container.config = new Config()
container.prefix = container.config.bot.prefix container.prefix = container.config.bot.prefix
container.version = '5.0.0-yogurt_canary.250308b' container.version = '5.0.0-yogurt_canary.250309a'
container.embedColors = { container.embedColors = {
default: 0xaddb87, default: 0xaddb87,
fail: 0xff0000, fail: 0xff0000,

View file

@ -19,6 +19,14 @@ export default class DeleteLearnedDataHandler extends InteractionHandler {
public async parse( public async parse(
interaction: StringSelectMenuInteraction | ButtonInteraction, interaction: StringSelectMenuInteraction | ButtonInteraction,
) { ) {
if (
!interaction.customId.startsWith(
MuffinCustomId.DeleteLearnedDataCancel,
) ||
!interaction.customId.startsWith(MuffinCustomId.DeleteLearnedDataUserId)
)
return this.none()
const userId = interaction.isButton() const userId = interaction.isButton()
? interaction.customId.slice( ? interaction.customId.slice(
MuffinCustomId.DeleteLearnedDataCancel.length, MuffinCustomId.DeleteLearnedDataCancel.length,

View file

@ -13,6 +13,7 @@ export default class ClientReadyListener extends Listener {
owners: [this.container.config.bot.ownerId], owners: [this.container.config.bot.ownerId],
secrets: [this.container.config.databaseUrl], secrets: [this.container.config.databaseUrl],
aliases: ['dokdo', 'dok', 'Dokdo', 'Dok', '테스트'], aliases: ['dokdo', 'dok', 'Dokdo', 'Dok', '테스트'],
globalVariable: { container: this.container },
noPerm: async msg => noPerm: async msg =>
await msg.reply({ await msg.reply({
content: '당신은 내 제작자가 아니잖아!', content: '당신은 내 제작자가 아니잖아!',