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
+10 -9
View File
@@ -1,5 +1,5 @@
import {
MessageEmbed,
EmbedBuilder,
User,
MessagePayload,
MessageOptions,
@@ -11,7 +11,8 @@ import {
Message,
ColorResolvable,
Interaction,
InteractionReplyOptions
InteractionReplyOptions,
BaseInteraction
} from 'discord.js';
import App from '..';
@@ -43,7 +44,7 @@ interface EmbedDataPresets {
}
export function makeEmbed(data: EmbedData) {
const embed = new MessageEmbed();
const embed = new EmbedBuilder();
embed.setColor(data.color || '#FFFFFF');
if (!data.icon) embed.setTitle(data.title);
@@ -54,14 +55,14 @@ export function makeEmbed(data: EmbedData) {
if (data.setTimestamp) embed.setTimestamp();
if (data.user)
embed.footer = {
embed.setFooter({
text: `${data.user.username} | v${App.version}`,
iconURL: `${data.user.displayAvatarURL()}?size=4096`
};
});
else
embed.footer = {
embed.setFooter({
text: `v${App.version}`
};
});
if (data.fields) embed.addFields(data.fields);
@@ -160,8 +161,8 @@ export async function sendHybridInteractionMessageResponse(
data: HybridInteractionMessage,
payload: MessageOptions | InteractionReplyOptions,
replace = false
): Promise<Message | Interaction | undefined> {
if (data.isSlashCommand() || data.isButton() || data.isSelectMenu()) {
): Promise<Message | BaseInteraction | undefined> {
if (data.isApplicationCommand() || data.isButton() || data.isSelectMenu()) {
const messageComponent = data.getMessageComponentInteraction();
if (!messageComponent.replied) {