Skip to content

Commit

Permalink
fix: Fix discord.js type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hmes98318 committed Sep 26, 2024
1 parent 852a6f7 commit b10bf4f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/commands/nowplaying.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const execute = async (bot: Bot, client: Client, message: Message) => {
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(saveButton);

return message.channel.send({
return message.reply({
embeds: [embeds.save(bot.config.embedsColor, track!.title, subtitle, track!.uri, track!.thumbnail!)],
components: [row],
allowedMentions: { repliedUser: false }
Expand Down
8 changes: 4 additions & 4 deletions src/commands/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export const execute = async (bot: Bot, client: Client, message: Message, args:
});


const collector = message.channel.createMessageCollector({
const collector = (message.channel as any /* discord.js type error ? (v14.16.2) */).createMessageCollector({
time: 10000, // 10s
filter: m => m.author.id === message.author.id
filter: (m: any) => m.author.id === message.author.id
});

collector.on('collect', async (query: Message<boolean>) => {
Expand Down Expand Up @@ -219,9 +219,9 @@ export const slashExecute = async (bot: Bot, client: Client, interaction: ChatIn
});


const collector = interaction.channel!.createMessageCollector({
const collector = (interaction.channel as any /* discord.js type error ? (v14.16.2) */).createMessageCollector({
time: 10000, // 10s
filter: m => m.author.id === interaction.user.id
filter: (m: any) => m.author.id === interaction.user.id
});

collector.on('collect', async (query: Message<boolean>) => {
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/initial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function initial(bot: Bot, interactionOrMessage: ChatInputCommandInteracti
throw new TypeError("Invalid Interaction or Message type");
}

player.dashboard = await channel!.send({
player.dashboard = await (channel as any /* discord.js type error ? (v14.16.2) */).send({
embeds: [embeds.connected(bot.config.embedsColor)],
components: []
});
Expand Down
4 changes: 2 additions & 2 deletions src/events/discord/interactionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ export default async (bot: Bot, client: Client, interaction: Interaction) => {
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(select);
const msg = await interaction.reply({ content: `Select a song loop mode.`, ephemeral: true, components: [row] });

const collector = interaction.channel!.createMessageComponentCollector({
const collector = (interaction.channel as any /* discord.js type error ? (v14.16.2) */).createMessageComponentCollector({
time: 20000, // 20s
filter: i => i.user.id === interaction.user.id
filter: (i:any) => i.user.id === interaction.user.id
});

collector.on("collect", async (i: StringSelectMenuInteraction) => {
Expand Down
4 changes: 2 additions & 2 deletions src/events/lavashark/trackAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export default async (bot: Bot, _client: Client, player: Player, tracks: Track |
const playlist = tracks as unknown as Track[];
const subtitle = `Author : **${playlist[0]?.author}**\nDuration **${playlist[0]?.duration.label}**\n`;

await player.metadata?.channel?.send({ embeds: [embeds.addPlaylist(bot.config.embedsColor, playlist[0].title, subtitle, playlist[0].uri, playlist[0].thumbnail!)] });
await (player.metadata?.channel as any /* discord.js type error ? (v14.16.2) */).send({ embeds: [embeds.addPlaylist(bot.config.embedsColor, playlist[0].title, subtitle, playlist[0].uri, playlist[0].thumbnail!)] });
}
else {
const track = tracks as Track;
const subtitle = `Author : **${track?.author}**\nDuration **${track?.duration.label}**\n`;

await player.metadata?.channel?.send({ embeds: [embeds.addTrack(bot.config.embedsColor, track.title, subtitle, track.uri, track.thumbnail!)] });
await (player.metadata?.channel as any /* discord.js type error ? (v14.16.2) */).send({ embeds: [embeds.addTrack(bot.config.embedsColor, track.title, subtitle, track.uri, track.thumbnail!)] });
}

try {
Expand Down

0 comments on commit b10bf4f

Please sign in to comment.