How Do I Circumvent the 400 Characters Limit in Custom API?

Hi, so I was trying to make a Custom API Command for Borderlands 2’s Community Patch Notes (named !patchnotes), intended to work similar to the Quotes Custom API (so like !patchnotes 1 shows the first one listed in the Pastebin TXT, !patchnotes 2 shows the second one, and so on; all of them were intended to be separated by semi colons “;”), using a similar method from this Topic. Problem is, everytime I typed in !patchnotes, Nightbot will say “[Response must be less than 400 characters]”. Since I’m new to this and had no idea what to do, how do I fix the issue of Nightbot trying to show all of it instead of one-by-one like Quotes API?


The message on !patchnotes currently is $(eval notes = "$(urlfetch ".split(";"); notes[Math.floor(Math.random() * (notes.length - 1))])

Link for the Pastebin TXT list:

By using $(urlfetch json http://paste....) you’ll avoid the character limit issue.

1 Like

Wait… I don’t get it just yet.

So by using $(urlfetch json http://paste....) , do I need to add the variable name “notes” inside urlfetch itself while removing $(eval…) or do I add another variable name, different from “notes”, inside the $(urlfetch…)?

Your command in the start post was right, you just have to add the word json in front of the pastebin link.

Oh, oh… I get it now, so to circumvent the character limit, the message for !patchnotes is going to be $(eval notes = "$(urlfetch json ".split(";"); notes[Math.floor(Math.random() * (notes.length - 1))])?

EDIT: Tried that out, and yes that worked perfectly as I intended. Thanks for the help :wink:


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