JackW25
JackW25
Explore posts from servers
MIA🎶 Moonlink.js - Imagine a Music Application
Created by judicial-coral on 8/17/2024 in #help
Certain URLs Not Working
Starting today I've noticed an issue where 'query' is undefined, specifically in the loadTracks() function. if (query.startsWith("http://") || query.startsWith("https://")) ^ TypeError: Cannot read properties of undefined (reading 'startsWith') at \nodemodules\moonlink.js\dist\src\entities\Rest.js:23:23 This occurs when a YouTube link like https://www.youtube.com/watch?v=__ , https://youtu.be/___ , soundcloud.com, and deezer.com links Links work perfectly fine although from bandcamp.com or spotify.com I use this in my play.js to test URLs to make sure they're ok,
const urlPattern = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be|spotify\.com|soundcloud\.com|deezer\.com|bandcamp\.com)\/.+$/i;
const isLink = urlPattern.test(query);

if (isLink) {
const allowedSources = ['youtube.com', 'youtu.be', 'spotify.com', 'soundcloud.com', 'deezer.com', 'bandcamp.com'];
const domain = query.match(/:\/\/(www\.)?([^\/]+)/)[2];
if (!allowedSources.includes(domain)) {
return interaction.reply('The provided link is not from an allowed source!');
}
}
const urlPattern = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be|spotify\.com|soundcloud\.com|deezer\.com|bandcamp\.com)\/.+$/i;
const isLink = urlPattern.test(query);

if (isLink) {
const allowedSources = ['youtube.com', 'youtu.be', 'spotify.com', 'soundcloud.com', 'deezer.com', 'bandcamp.com'];
const domain = query.match(/:\/\/(www\.)?([^\/]+)/)[2];
if (!allowedSources.includes(domain)) {
return interaction.reply('The provided link is not from an allowed source!');
}
}
and search and load everything through
let req;
if (isLink) {
req = await client.manager.search(query);
} else {
req = await client.manager.search({
query,
source,
});
}
let req;
if (isLink) {
req = await client.manager.search(query);
} else {
req = await client.manager.search({
query,
source,
});
}
in Rest.js specifically, logging the value of query returns undefined in these cases. Does anybody have a clue as to what's going on? I'm new to Moonlink so I'm still a bit limited in what I know of it. Thank you
9 replies
DFDimensional Fun
Created by JackW25 on 4/3/2024 in #lavaclient
Some Problems Migrating to v5
Hey all, sorry this is probably a very stupid post, I haven’t touched this in over a year and I learned about Lavalink v4 and Lavaclient v5 being released After getting errors with searches returning 400 errors and whatnot, I decided to migrate my discord bot from Lavalink v3 and Lavaclient v4. I’ve come into many problems with this migration but I had a few I wasn’t sure about and I didn’t find any documentation for migrating. From what I can tell, @lavaclient/queue, @lavaclient/types, and @lavaclient/spotify are all deprecated and don’t work anymore? Are there any alternatives yet for these I can begin to implement into Lavaclient? My main errors now lie with these packages no longer working I don’t have much Java experience as someone mentioned Lavalink plug-ins to me, but I’d be terrible at those I was also told possibly about LavaSrc, but I’m not sure how I’d go at implementing that client side too. Again thank you! Sorry if this seems like a horribly stupid question, it’s been a while since I’ve touched JS
85 replies