Skip to content

Commit

Permalink
🎐 Related songs can now be added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maseshi committed May 2, 2024
1 parent df4de8e commit 5e6808d
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions source/commands/music/related.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js')

module.exports = {
permissions: [PermissionFlagsBits.SendMessages],
data: new SlashCommandBuilder()
.setName('related')
.setDescription('Songs related to the currently playing song')
.setDescriptionLocalizations({
th: 'เพลงที่เกี่ยวข้องกับเพลงที่เล่นอยู่',
})
.setDefaultMemberPermissions()
.setDMPermission(false)
.addSubcommand((option) =>
option
.setName('add')
.setDescription('Add related songs to the queue.')
.setDescriptionLocalizations({
th: 'เพิ่มเพลงที่เกี่ยวข้องลงในคิว.',
})
),
async execute(interaction) {
const djs = interaction.client.configs.djs
const queue = interaction.client.player.getQueue(interaction)

if (!queue)
return await interaction.reply(
interaction.client.i18n.t('commands.related.no_queue')
)
if (djs.enable) {
if (
interaction.user.id !== queue.songs[0].user.id &&
queue.autoplay === false
)
return await interaction.reply(
interaction.client.i18n.t('commands.related.not_queue_owner')
)
if (
djs.users.includes(interaction.user.id) &&
djs.roles.includes(
interaction.member.roles.cache.map((role) => role.id)
) &&
djs.only
)
return await interaction.reply(
interaction.client.i18n.t('commands.related.not_a_dj')
)
}

const relatedSong = await interaction.client.player.addRelatedSong(
interaction.guild
)

await interaction.reply(
interaction.client.i18n.t('commands.related.added_related_song', {
name: relatedSong.name,
duration: relatedSong.formattedDuration,
})
)
},
}

0 comments on commit 5e6808d

Please sign in to comment.