Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Short bug description #331

Open
B3ni15 opened this issue Feb 2, 2024 · 0 comments
Open

[BUG] Short bug description #331

B3ni15 opened this issue Feb 2, 2024 · 0 comments
Assignees
Labels

Comments

@B3ni15
Copy link

B3ni15 commented Feb 2, 2024

Bug Description
For some reason, it always says "client not defined" and I always get this error.

Reproduction Steps
Steps to reproduce the behavior:

  1. start the bot

and error..

Expected Result
Bot should start without error!

Attachments
image
image

My Command:

const { MessageEmbed } = require("discord.js");

const { Player } = require("discord-music-player");
const player = new Player(client, {
    leaveOnEmpty: false,
});;

module.exports = {
    name: "play",
    description: "Zene Lejátszása",
    category: "song",
    slash: true,
    options: [
        {
          name: "zene",
          description: "Zene linkje amit szeretnél leállítani!",
          type: "STRING",
          required: true,
        },
    ],
    global: true,
    error: async () => {},
    run: async (data) => {
        const zene = data.interaction.options.getString('zene');
        const voiceChannel = data.interaction.member.voice.channel;
        let queue = player.createQueue(data.interaction.guild.id);
        let guildQueue = player.getQueue(data.interaction.guild.id);


        if (!zene) {
            return data.interaction.reply("> Kérlek adj meg egy zenét!");
        }

        if (!voiceChannel) {
            return data.interaction.reply("> Legyél bent egy hangcsatornában!");
        }

        await queue.join(voiceChannel);
        let song = await queue.play(zene).catch(err => {
            console.log(err);
            if(!guildQueue)
                queue.stop();
        });

        const embed = new MessageEmbed()
            .setTitle(`Zene Lejátszása`)
            .setDescription(`> Beléptem a hangcsatornába és elkezdtem lejátszani a zenét!`)
            .setTimestamp()
            .addField("Zene:", queue.author, true)
            .addField("Hossz:", queue.duration, true)
            .addField("Link:", queue.url, true)
            .addField("Hozzáadta:", queue.requestedBy, true)
            .setThumbnail(queue.thumbnail)
            .setColor("#7289DA");


        data.interaction.editReply({
            embeds: [embed],
        });
    },
};

Versioning:

  • OS: Ubuntu 22.04
  • Node Version v16.20.2
  • Module Version v8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants