Hello y’all,
Does anyone know how to check if a perchance generator name exists on perchance?
Context:
I’ve added a feature to allow users to load their own datasets into the fusion-gen. The code is above, but the feature itself looks like this:
I’d like to be able to check if the string matches a generator that exists on perchance. Does anyone know the name of that function?
You must log in or register to comment.
You can possibly use the API that retrieves the generator’s stats for the generator cards. Though you need to make the function an async function.
async loadUserDataset() => // Need to change it to an Async function to wait for the data to be retrieved. ... if(userDataset != "") { let result = await fetch("/api/getGeneratorStats?names="+userDataset).then(r => r.json()); // Gets the Generator Stats let gens = result.data; // Returns an Array of Generator if (gens.length > 0) { // If there is data document.userDataset = userDataset; } else { // if not alert('Perchance Page Not Found'); document.userDataset = 'template-fusion-generator-dataset' // or any default pages } } ... update() // to refresh the display, or you can use element.innerHTML = this new value