-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update pnpm-lock.yaml and util/embed.js
- Loading branch information
1 parent
84c0c5b
commit af0fb71
Showing
4 changed files
with
70 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { getLocale } = require('../../lang/lang.js'); | ||
const { | ||
createMessageEmbed, | ||
createMusicEmbed, | ||
createButton, | ||
} = require('../../util/embed.js'); | ||
|
||
const guilds = require('../../data/guilds.json'); | ||
|
||
const { SlashCommandBuilder } = require('discord.js'); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder().setName('resume').setDescription('Resume music'), | ||
async execute(interaction) { | ||
await interaction.deferReply(); | ||
const guildId = interaction.guild.id; | ||
if (!interaction.member.voice.channelId || !globalThis.queue[guildId]) { | ||
const noValidVCEmbed = createMessageEmbed( | ||
getLocale(guilds[guildId].locale).vc.noVC, | ||
interaction | ||
); | ||
await interaction.editReply({ embeds: [noValidVCEmbed] }); | ||
return; | ||
} | ||
|
||
if (globalThis.queue[guildId].voiceChannel) { | ||
if ( | ||
globalThis.queue[guildId].voiceChannel.id !== | ||
interaction.member.voice.channelId | ||
) { | ||
const differentVCEmbed = createMessageEmbed( | ||
getLocale(guilds[guildId].locale).vc.differentVC, | ||
interaction | ||
); | ||
await interaction.editReply({ embeds: [differentVCEmbed] }); | ||
return; | ||
} | ||
} | ||
|
||
await globalThis.queue[guildId].player.get(); | ||
await globalThis.queue[guildId].player.resume(); | ||
const embed = createMessageEmbed( | ||
getLocale(guilds[guildId].locale).vc.resumed, | ||
interaction | ||
); | ||
await interaction.editReply({ embeds: [embed] }); | ||
const panel = await createMusicEmbed(guildId); | ||
await globalThis.queue[guildId].panel.edit({ | ||
embeds: [panel], | ||
components: createButton('resume'), | ||
}); | ||
return; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters