3chospirits / discord-music-bot

55 stars 107 forks source link

Stage Channel #4

Open arturious opened 2 years ago

arturious commented 2 years ago

can he play in stage channel?

Screenshot 2022-04-28 at 14 12 46
arturious commented 2 years ago

so that he sits in the role of a speaker and plays music 24/7

arturious commented 2 years ago

like radio)

Nguyenwasd72 commented 2 years ago

yes, bot can play in stage _ 24/7: loop.js (works for both vc and stage)

const { SlashCommandBuilder } = require("@discordjs/builders")
const { MessageEmbed } = require("discord.js")

module.exports = {
    data: new SlashCommandBuilder().setName("loop").setDescription("Loops the current song")
    .addStringOption((option) => option.setName("mode").setDescription("Choose mode").setRequired(true).addChoices(
    { name: 'on', value: 'on' },
    { name: 'off', value: 'off' }
)),
    run: async ({ client, interaction }) => {
        let mode = false
        const queue = client.player.getQueue(interaction.guildId)

        const noSongPlayingEmbed = new MessageEmbed()
        .setTitle("Error")
        .setDescription("There is no song playing")
        .setColor("RED")

        if (!queue) {
            await interaction.editReply({ embeds: [noSongPlayingEmbed] })
        }
        else {
            switch (interaction.options.getString("mode")) {
                case 'off':
                    mode = 0
                    break
                case 'on':
                    mode = 1
                    break
            }
            mode = queue.setRepeatMode(mode)
            mode = mode == 1 ? 'on' : 'off'
            const modeEmbed = new MessageEmbed()
                .setTitle("Loop Mode")
                .setDescription(`Set loop mode is now **${mode}**`)
            await interaction.editReply({ embeds: [modeEmbed] })
        }
    }
}