I have a Nightbot command for Twitch that outputs a basic “[USER] is a/an [ADJECTIVE] [NOUN] [CLAUSE]” type sentence, with each pulling from a pastebin list. This all functions as I want it to. However, I am trying to figure out how to create a stats command for it that will display the number of items in each list, and the total number of combinations. Ideal output would be something like "Command has COUNT1 adjectives, COUNT2 nouns, and COUNT3 clauses for a total of [COUNT1*COUNT2*COUNT3] combinations!"
How can I achieve this?
Alternatively, if it’s not possible, is there a way to force nightbot to return a specific line from a pastebin? I have a hacky workaround in mind if I can do that.
The info on the length property was extremely helpful. I was able to automatically pull the list lengths for the stats command. I’m just not sure how to output math using those numbers now for the total combinations:
I’ve tried a few different things but really not sure what I’m doing. I’m a bit concerned about character count at this point, so I might resign to just using a fuzzy version of the number (like “almost 48 million”) and updating it manually here and there.
$(eval l = (u) => u.split(`;`).length - 1; a = l(`$(urlfetch json RAW_PASTEBIN_LINK)`); n = l(`$(urlfetch json RAW_PASTEBIN_LINK)`); c = l(`$(urlfetch json RAW_PASTEBIN_LINK)`); `The !iam command currently has ${a} adjectives, ${n} nouns, and ${c} clauses. That's ${Intl.NumberFormat().format(a * n * c)} possible combinations!`)
I had tried having them all in one $(eval) but I must have been messing something up a bit because it wasn’t working. Jumping into making commands has been a heck of a time. I took a javascript class about a decade ago, but that’s all I really have for experience.