NightBot $(URLfetch) Error on Unicode name

Asked Oct 29, 2022·1 reply·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hello guys!
I need a help, I have made point system. It works good, but when it comes to viewer's name contains Unicode character, it returns "​Error Connecting To Remote Server".

here is my command : $(urlfetch json http://xxxxxxxxxxx/points?id=$(userid)&name=$(user))
and here is my code in my backend 🙂

app.get('/points', async (req, res) => {
let userId = req.query.id;
let userName = req.query.name.toString();
//console.log(userName);
const rndCoins = await updateData(userId, userName);
const userDetails0 = await getUserPoints(userId);
const numinString = intToString(userDetails.points);
res.send("Congrats!! 😁 " + userName + " you got +" + rndPoints + " points😳 Your total points are " + numinString );
}
});

Please help me.

1 reply

Hey @Agile Sheep!

We don't provide support for third party APIs, even less for one you wrote yourself, this isn't a programming support forum, and it's not our fault if the usernames contain Unicode characters, they come from Twitch.

In JavaScript there's a method that should help you: encodeURIComponent().