Fixed discord.js v14 breaking changes

This commit is contained in:
2022-06-29 15:27:42 +07:00
parent 5c70395f50
commit 0f73f8f464
21 changed files with 340 additions and 326 deletions
+9 -7
View File
@@ -8,7 +8,9 @@ import {
TextBasedChannel,
MessageComponentInteraction,
User,
SelectMenuInteraction
SelectMenuInteraction,
InteractionType,
BaseInteraction
} from 'discord.js';
export default class DiscordModule {
@@ -56,17 +58,17 @@ export default class DiscordModule {
}
export class HybridInteractionMessage {
public data: Interaction | Message;
constructor(data: Interaction | Message) {
public data: BaseInteraction | Message;
constructor(data: BaseInteraction | Message) {
this.data = data;
}
public isInteraction(): boolean {
return this.data instanceof Interaction;
return this.data instanceof BaseInteraction;
}
public isSlashCommand(): boolean {
return this.data instanceof CommandInteraction && this.data.isCommand();
public isApplicationCommand(): boolean {
return this.data instanceof CommandInteraction && this.data.type === InteractionType.ApplicationCommand;
}
public isButton(): boolean {
@@ -130,7 +132,7 @@ export class HybridInteractionMessage {
return this.data as Message;
}
public getRaw(): Interaction | Message {
public getRaw(): BaseInteraction | Message {
return this.data;
}
}