Custom API so i dont get limited to 400 characters per link

Asked Jan 25, 2020·4 replies·Last activity 6 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.

Hey i was seeing if there was any way i could make a custom api for night bot to randomly pick off so i dont get limited to the 400 character limit that goes with paste bin and night bot

this is what ive made so far for my custom !fact command
!commands edit !Fact $(eval a="$(urlfetch ht tps://pastebin.com/raw/peWM4VTr)".split(","); b="$(urlfetch ht tps://pastebin.com/raw/8E6CeNMG)".split(","); c="$(urlfetch h ttps://pastebin.com/raw/e1Aq8vzM)".split(","); d="$(urlfetch ht tps://pastebin.com/raw/ycpLqWSv)".split(","); e="$(urlfetch ht tps://pastebin.com/raw/SAkDS155)".split(","); f="$(urlfetch ht tps://pastebin.com/raw/ZqtUNpyY)".split(","); g=a.concat(a); g[Math.floor(Math.random() * (c.length-1))];)

thank you in advance

wink.png

4 replies

Put all your random facts into a single Paste, and use a single json urlfetch to read off the Paste:

!commands edit !fact $(eval a=`$(urlfetch json https://pastebin.com/raw/FOOrBARj)`.split(`,`);a[Math.floor(Math.random()*(a.length-1))])

yeab but with this link with over 120 facts its just comes back to the same response it gave me before saying over 400 characters

!commands edit !fact $(eval a=`$(urlfetch json ht
tps://pastebin.com/raw/jPrusAWQ).split(,`);a[Math.floor(Math.random()*(a.length-1))])

The end of each line in your new paste has a semicolon instead of a comma, so you have to use a semicolon instead of a comma in the split() function. I fixed the command response.

!commands edit !fact $(eval a=`$(urlfetch json https://pastebin.com/raw/jPrusAWQ)`.split(`;`);a[Math.floor(Math.random()*(a.length-1))])

thank you this has had me scratching my head for a while