mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-11-04 15:59:32 +00:00 
			
		
		
		
	updated seek
This commit is contained in:
		@@ -12,13 +12,16 @@ module.exports = {
 | 
				
			|||||||
        if (client.funcs.check(client, msg, command)) {
 | 
					        if (client.funcs.check(client, msg, command)) {
 | 
				
			||||||
            let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
 | 
					            let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
 | 
				
			||||||
            if (!args[1]) return msg.channel.send(`<:redx:674263474704220182> Correct usage: \`${prefix}seek <seeking point in seconds>\``);
 | 
					            if (!args[1]) return msg.channel.send(`<:redx:674263474704220182> Correct usage: \`${prefix}seek <seeking point in seconds>\``);
 | 
				
			||||||
 | 
					            let point = args[1];
 | 
				
			||||||
            const pos = parseInt(args[1]);
 | 
					            const pos = parseInt(args[1]);
 | 
				
			||||||
            if (isNaN(pos)) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.');
 | 
					            if (isNaN(pos)) {
 | 
				
			||||||
                if (pos < 0) return msg.channel.send('<:redx:674263474704220182> The seeking point needs to be a positive number!');
 | 
					                if (pos < 0) return msg.channel.send('<:redx:674263474704220182> The seeking point needs to be a positive number!');
 | 
				
			||||||
                if (pos > data.length_seconds) return msg.channel.send(`<:redx:674263474704220182> The lenght of this song is ${data.length_seconds} seconds! You can't seek further than that!`);
 | 
					                if (pos > data.length_seconds) return msg.channel.send(`<:redx:674263474704220182> The lenght of this song is ${data.length_seconds} seconds! You can't seek further than that!`);
 | 
				
			||||||
 | 
					                point = pos;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            serverQueue.connection.dispatcher.end();
 | 
					            serverQueue.connection.dispatcher.end();
 | 
				
			||||||
            serverQueue.endReason = "seek";
 | 
					            serverQueue.endReason = "seek";
 | 
				
			||||||
            client.funcs.play(msg.guild, serverQueue.songs[0], client, msg, pos, false);
 | 
					            client.funcs.play(msg.guild, serverQueue.songs[0], client, msg, point, false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ module.exports = async function (guild, song, client, seek, play) {
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const dispatcher = serverQueue.connection
 | 
					    const dispatcher = serverQueue.connection
 | 
				
			||||||
        .play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false }), { seek: seek, bitrate: 1024, passes: 10, volume: 1, bassboost: serverQueue.bass })
 | 
					        .play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false, begin: seek }), { seek: 0, bitrate: 1024, passes: 10, volume: 1, bassboost: serverQueue.bass })
 | 
				
			||||||
        .on("finish", () => {
 | 
					        .on("finish", () => {
 | 
				
			||||||
            client.dispatcher.finish(client, serverQueue.endReason, guild);
 | 
					            client.dispatcher.finish(client, serverQueue.endReason, guild);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user