kabirjaipal / JUGNU-MUSIC

Top-notch Music Bot with Buttons, premium Filters, sleek UI, dedicated bot channel support. Built on Distube.JS, Discord.JS, Express.js, and Josh wrapper for SQL and Mongoose
https://jugnu.netlify.app
MIT License
265 stars 367 forks source link

Crashing after seeking #18

Closed dotcfg closed 2 years ago

dotcfg commented 2 years ago

grafik

Optional:

Add fseek command to forward seek (incl buttons to seek +10 secs and - 10 secs!) add a syntax like /seek 1m = 1 min, 1h = 1hour etc makes it users easyer to seek!

ItzRandom23 commented 2 years ago

i fixed the issue but Kabu again changed Ahhh.... Dm Kabu

ItzRandom23 commented 2 years ago

use this and tell me if it fixed

const ee = require("../../settings/embed.json");
const config = require("../../settings/config.json");
const emoji = require("../../settings/emoji.json");
const player = require("../../handlers/player");
const { check_dj } = require("../../handlers/functions");

module.exports = new Command({
  // options
  name: "seek",
  description: `set seek current song`,
  userPermissions: [""],
  botPermissions: ["CONNECT"],
  category: "Music",
  cooldown: 5,
  DJ: true,
  options: [
    {
      name: "amount",
      description: `Give seek amount in number`,
      type: "NUMBER",
      required: true,
    },
  ],
  // command start
  run: async ({ client, interaction, args, prefix }) => {
    // Code
    let channel = interaction.member.voice.channel;
    let queue = await player.getQueue(interaction.guild.id);
    if (!channel) {
      return interaction.followUp(
        `** ${emoji.ERROR} You Need to Join Voice Channel first **`
      );
    } else if (
      interaction.guild.me.voice.channel &&
      !interaction.guild.me.voice.channel.equals(channel)
    ) {
      return interaction.followUp(
        `** ${emoji.ERROR} You Need to Join __My__ Voice Channel **`
      );
    } else if (interaction.guild.me.voice.serverMute) {
      return interaction.followUp(
        `** ${emoji.ERROR} I am Muted in Voice Channel , unmute me first **`
      );
    } else if (!queue) {
      return interaction.followUp(`** ${emoji.ERROR} Nothing Playing Now **`);
    } else if (check_dj(client, interaction.member, queue.songs[0])) {
      return interaction.followUp(
        `** ${emoji.ERROR} You are Not DJ and also not Song Requester **`
      );
    } else {
      let seeksong = interaction.options.getNumber("amount")
                if (seeksong > queue.songs[0].duration || seeksong < 0) return interaction.reply({
                    embeds: [
                        new MessageEmbed().setColor(ee.wrongcolor).setTitle(`${client.allEmojis.x} **The Seek Position must be between \`0\` and \`${Queue.songs[0].duration}\`!**`)
                    ] });
await queue.seek(seeksong);
    }
  },
});
dotcfg commented 2 years ago

If i use your code as it was before the bots seeks but dont send a message if it seeked that is what koku fixxed but he did it wrong idk

ItzRandom23 commented 2 years ago

u said the bot crash before

dotcfg commented 2 years ago

on kabus version the bots craches after seeking. on yours its seeking but dont send a output like "i seeked to your location"!

ItzRandom23 commented 2 years ago

ohk i will fix it