diff --git a/src/buttons/loader.ts b/src/buttons/loader.ts index ef3823b..25c451a 100644 --- a/src/buttons/loader.ts +++ b/src/buttons/loader.ts @@ -5,6 +5,7 @@ import { Client, Message, MessageComponentInteraction, + MessageFlags, } from "discord.js"; import { getLocale } from "../utils/locales"; @@ -58,7 +59,7 @@ export const collect = ( if (!button) { interaction.reply({ content: loc.get("e_interacreate_no_button"), - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } diff --git a/src/commands/misc/archive.ts b/src/commands/misc/archive.ts index 7dec644..f42abdd 100644 --- a/src/commands/misc/archive.ts +++ b/src/commands/misc/archive.ts @@ -5,6 +5,7 @@ import { Colors, CommandInteraction, EmbedBuilder, + MessageFlags, NonThreadGuildBasedChannel, } from "discord.js"; import "../../modules/string"; @@ -66,7 +67,7 @@ export default { // Category doesn't exist or is not included return interaction.reply({ content: `${loc.get("c_archive3")} \`${desiredCat}\``, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } diff --git a/src/commands/misc/help.ts b/src/commands/misc/help.ts index a3811c3..21f9612 100644 --- a/src/commands/misc/help.ts +++ b/src/commands/misc/help.ts @@ -5,6 +5,7 @@ import { Client, Colors, EmbedBuilder, + MessageFlags, } from "discord.js"; import "../../modules/string"; import { getLocale, getLocalizations } from "../../utils/locales"; @@ -110,13 +111,13 @@ export default { const command = NameNotLocalized(client, possible_command); if (!command) { - return interaction.reply({ content: error, ephemeral: true }); + return interaction.reply({ content: error, flags: [MessageFlags.Ephemeral] }); } const scope = client.commands.list.get(command.name)?.scope(); if (scope!.length > 0 && scope?.find((id) => id === interaction.guildId) === undefined) { // Command not available for the current guild - return interaction.reply({ content: error, ephemeral: true }); + return interaction.reply({ content: error, flags: [MessageFlags.Ephemeral] }); } let subcommand = undefined; @@ -128,7 +129,7 @@ export default { if (!command || subcommand === undefined) { // Sub/Command don't exist - return interaction.reply({ content: error, ephemeral: true }); + return interaction.reply({ content: error, flags: [MessageFlags.Ephemeral] }); } // Loads the data according to the user's locals diff --git a/src/commands/misc/ping.ts b/src/commands/misc/ping.ts index b2c98c0..87c6344 100644 --- a/src/commands/misc/ping.ts +++ b/src/commands/misc/ping.ts @@ -1,5 +1,5 @@ import { SlashCommandBuilder } from "@discordjs/builders"; -import { ChatInputCommandInteraction, Client, Message } from "discord.js"; +import { ChatInputCommandInteraction, Client } from "discord.js"; import { getLocale, getLocalizations } from "../../utils/locales"; import { getFilename } from "../../utils/misc"; @@ -18,14 +18,14 @@ export default { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => { const loc = getLocale(client, interaction.locale); - const sent = (await interaction.reply({ + const sent = await interaction.reply({ content: "Pinging...", - fetchReply: true, - })) as Message; + withResponse: true, + }); interaction.editReply( `${loc?.get("c_ping1")}: \ -${sent.createdTimestamp - interaction.createdTimestamp}ms +${sent.resource!.message!.createdTimestamp - interaction.createdTimestamp}ms ${loc?.get("c_ping2")}: ${client.ws.ping}ms.`, ); }, diff --git a/src/commands/misc/prep.ts b/src/commands/misc/prep.ts index 423c8dc..8c8f39e 100644 --- a/src/commands/misc/prep.ts +++ b/src/commands/misc/prep.ts @@ -1,5 +1,12 @@ import { SlashCommandBuilder } from "@discordjs/builders"; -import { ChannelType, Client, Colors, CommandInteraction, EmbedBuilder } from "discord.js"; +import { + ChannelType, + Client, + Colors, + CommandInteraction, + EmbedBuilder, + MessageFlags, +} from "discord.js"; import "../../modules/string"; import { getLocale, getLocalizations } from "../../utils/locales"; import { getFilename } from "../../utils/misc"; @@ -59,7 +66,7 @@ export default { // Category doesn't exist or is not allowed return interaction.reply({ content: `${loc.get("c_prep3")} \`${desired_cat}\``, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } diff --git a/src/commands/misc/reminder.ts b/src/commands/misc/reminder.ts index 6471508..2ca0d3b 100644 --- a/src/commands/misc/reminder.ts +++ b/src/commands/misc/reminder.ts @@ -5,6 +5,7 @@ import { ButtonStyle, ChatInputCommandInteraction, Client, + MessageFlags, ModalBuilder, TextInputBuilder, TextInputStyle, @@ -162,13 +163,13 @@ export default { .then((msg) => interaction.reply({ content: msg as string, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }), ) .catch((err) => { interaction.reply({ content: err, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); }); } else { @@ -233,16 +234,16 @@ export default { .setStyle(ButtonStyle.Primary), ); - const message = await interaction.reply({ - ephemeral: true, + const callback = await interaction.reply({ + flags: [MessageFlags.Ephemeral], embeds: [list], components: [row], - fetchReply: true, + withResponse: true, }); // Buttons interactions - collect(client, interaction, idPrec, message); - collect(client, interaction, idNext, message); + collect(client, interaction, idPrec, callback.resource!.message!); + collect(client, interaction, idNext, callback.resource!.message!); return; } @@ -254,7 +255,7 @@ export default { if (id === null) { return interaction.reply({ content: loc.get(`c_${filename}2`), - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } @@ -264,7 +265,7 @@ export default { ) { return interaction.reply({ content: loc.get(`c_${filename}3`), - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } @@ -276,7 +277,7 @@ export default { return deleteReminder(client, reminderInfo.creation_date, reminderInfo.user_id).then(() => interaction.reply({ content: `Reminder **#${id}** supprimé !`, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }), ); } diff --git a/src/commands/music/lyrics.ts b/src/commands/music/lyrics.ts index d420d85..bc763f1 100644 --- a/src/commands/music/lyrics.ts +++ b/src/commands/music/lyrics.ts @@ -1,6 +1,12 @@ import { SlashCommandBuilder } from "@discordjs/builders"; import { useMainPlayer, useQueue } from "discord-player"; -import { ChatInputCommandInteraction, Client, EmbedBuilder, Message } from "discord.js"; +import { + ChatInputCommandInteraction, + Client, + EmbedBuilder, + Message, + MessageFlags, +} from "discord.js"; import { getLocale, getLocalizations } from "../../utils/locales"; import { getFilename } from "../../utils/misc"; import { discord_limit_message } from "../../utils/constants"; @@ -90,7 +96,7 @@ export default { await interaction.deferReply(); const player = useMainPlayer(); - const queue = useQueue(interaction.guildId!); + const queue = useQueue(); if (request) { if ( interaction.options.getSubcommand() === @@ -110,7 +116,7 @@ export default { if (track) { try { data = await player.lyrics.search({ - q: track.cleanTitle + " " + queue.history.currentTrack?.author, + q: track.author + " " + track.cleanTitle, }); } catch { return await interaction.followUp(`❌ | ${loc.get("c_lyrics2")} \`${track.title}\``); @@ -169,7 +175,7 @@ export default { return await interaction.followUp({ content: `🎤 | ${loc.get("c_lyrics4")}`, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } diff --git a/src/commands/music/play.ts b/src/commands/music/play.ts index a78d996..954c950 100644 --- a/src/commands/music/play.ts +++ b/src/commands/music/play.ts @@ -5,6 +5,7 @@ import { ChatInputCommandInteraction, Client, EmbedBuilder, + MessageFlags, } from "discord.js"; import { getLocale, getLocalizations } from "../../utils/locales"; import { Metadata } from "../../utils/metadata"; @@ -84,7 +85,7 @@ export default { if (!member?.voice.channelId) { return await interaction.reply({ content: `❌ | ${loc.get("c_play1")}`, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } @@ -94,7 +95,7 @@ export default { ) { return await interaction.reply({ content: `❌ | ${loc.get("c_play2")} ${interaction.guild.members.me.voice.channel}`, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } @@ -142,7 +143,7 @@ export default { queue.delete(); return await interaction.reply({ content: `❌ | ${loc.get("c_play3")}`, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } diff --git a/src/commands/music/queue.ts b/src/commands/music/queue.ts index 3304062..f4103f8 100644 --- a/src/commands/music/queue.ts +++ b/src/commands/music/queue.ts @@ -127,15 +127,15 @@ export default { ), ); - const message = await interaction.reply({ + const callback = await interaction.reply({ embeds: [embed], components: rows, - fetchReply: true, + withResponse: true, }); // Buttons interactions - collect(client, interaction, idPrec, message); - collect(client, interaction, idNext, message); + collect(client, interaction, idPrec, callback.resource!.message!); + collect(client, interaction, idNext, callback.resource!.message!); return; } diff --git a/src/events/interactions/interactionCreate.ts b/src/events/interactions/interactionCreate.ts index 42ea10e..62c5e5d 100644 --- a/src/events/interactions/interactionCreate.ts +++ b/src/events/interactions/interactionCreate.ts @@ -1,4 +1,4 @@ -import { Client, Interaction, InteractionType } from "discord.js"; +import { Client, Interaction, InteractionType, MessageFlags } from "discord.js"; import { getLocale } from "../../utils/locales"; import { useMainPlayer } from "discord-player"; @@ -11,7 +11,7 @@ export default (interaction: Interaction, client: Client) => { if (!command) { return interaction.reply({ content: loc.get("e_interacreate_no_command"), - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } @@ -32,7 +32,7 @@ export default (interaction: Interaction, client: Client) => { if (!modal) { return interaction.reply({ content: loc.get("e_interacreate_no_modal"), - ephemeral: true, + flags: [MessageFlags.Ephemeral], }); } diff --git a/src/modals/misc/reminderGUI.ts b/src/modals/misc/reminderGUI.ts index 4458e84..c91b818 100644 --- a/src/modals/misc/reminderGUI.ts +++ b/src/modals/misc/reminderGUI.ts @@ -1,4 +1,4 @@ -import { Client, ModalSubmitInteraction } from "discord.js"; +import { Client, MessageFlags, ModalSubmitInteraction } from "discord.js"; import { getFilename } from "../../utils/misc"; import { newReminder } from "../../utils/commands/reminder"; @@ -19,7 +19,7 @@ export default { }).then((msg) => interaction.reply({ content: msg as string, - ephemeral: true, + flags: [MessageFlags.Ephemeral], }), ); },