Character limit for a custom API

Hi! Sorry for maybe stupid question. I don’t know anything about programming, I just made some code from a bunch of different codes I found on the internet and it worked with a Nightbot. The only problem that I have now - is that the bot only shows 400 characters of the Urban Dictionary definition.
I read, that it’s possingle to use json to remove the limit, but I can’t modify my code myself.

Here it is:

$(urlfetch https://api.scorpstuff.com/urbandictionary.php?term=$(queryencode $(1:)))

I would be very glad if someone could help!

Hey @Emeraldmoon!

Using the json parameter for the $(urlfetch) only works when you want to pull code or text that’s longer than 400 characters, but the output must always be 400 characters maximum.
What I’m gonna do here is crop the output, and I’ll also fix your command, because I wonder how it works:

$(eval `$(urlfetch json https://api.scorpstuff.com/urbandictionary.php?term=$(querystring))`.slice(0, 400))

Consider reading the documentation.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.