Use pastebin to avoid 500 characters limitation

I’m a fledgling engineer.
As the title says, I found out that I can use pastebin to get around nightbot’s 500 character limit.
But I cannot find enough information.

One command can be written in 499 characters and it worked fine with nightbot. However, one variable increased due to maintenance, so it exceeded 500 characters and could not be described.
The contents are stored in pastebin as they are (over 500 chars).
I thought it could be executed by fetching with urlfetch and eval, but the familiar Nightbot:missing ) after argument list is emitted.

Pasting the raw command data here is discouraged because the access token is pasted in pastebin, but the content is roughly as follows after masked it with xxx or XXX.

$(eval const c = $(urlfetch json http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=xxx&key=xxxxxxxxxx);const r = $(urlfetch https://xxx.co.jp/id=XXXX&query=XXXX);var td = new Date().getTimezoneOffset()/60;var date = new Date(r["updated_at"]*1000); date = new Date(date.setHours(date.getHours()+9+td));const dt = date.getMonth()+1+`/`+date.getDate()+` `+date.getHours()+`:`+date.getMinutes().toString().padStart(2,"0");`Your number of the global ranking is ${c["playerstats"]["stats"][115]["value"]}, and the position is ${rank["position"]}th (last updated at `+dt+`)`;)

You just need to have all nightbot variables outside of the actual pastebin link ($(user),$(urlfetch),$(query),etc.):

$(eval 
const c = $(urlfetch json http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=xxx&key=xxxxxxxxxx);
const r = $(urlfetch https://xxx.co.jp/id=XXXX&query=XXXX);
$(urlfetch json raw_pastebin_link)
)

The pastebin would then have the rest of the code in it:

var td = new Date().getTimezoneOffset()/60;
var date = new Date(r["updated_at"]*1000);
date = new Date(date.setHours(date.getHours()+9+td));
const dt = date.getMonth()+1+`/`+date.getDate()+` `+date.getHours()+`:`+date.getMinutes().toString().padStart(2,"0");
`Your number of the global ranking is ${c["playerstats"]["stats"][115]["value"]}, and the position is ${rank["position"]}th (last updated at `+dt+`)`;

Also if you don’t want to use pastebin you don’t have to use var and const. You can also make each variable 1 character which should help with total characters.

2 Likes

Hi potatoeaterlove,

What a clear and accurate answer.
The question has been resolved.
Thank you for your cooperation very much.

FYI,
The URI of the steam api is too long, so I was able to save the number of characters by shortening it with bitly.
Nightbot seems to resolve names even with shortened URLs.

BRs,

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