@thekatisalie
Like xgerhard said, having json
in $(urlfetch)
allows Nightbot to pull responses that are over 400 characters long, so feel free to move all of your responses onto one single Pastebin file. This will remove the need to use concat() to combine multiple lists of responses.
Choose an uncommonly used character or string of characters to use as your separator in split() and to put at the end of each response. The problem with using a common character like a comma is that there are other commas located in places other than at the end of each response. This means that your responses will get split in the wrong places. For example, look at these lines from https://pastebin.com/raw/hNzmAjNn
What’s the best book or series that you’ve ever read?,
If you didn’t have to sleep, what would you do with the extra time?,
Using a comma as the separator in split(), the responses should be:
What’s the best book or series that you’ve ever read?
If you didn’t have to sleep, what would you do with the extra time?
But because there’s a comma inside the second line, the responses will actually be:
What’s the best book or series that you’ve ever read?
If you didn’t have to sleep
what would you do with the extra time?
Your other set of responses at https://pastebin.com/raw/jcyPPsci has many commas per line, which will make the list of responses an even bigger mess.
Therefore I suggest putting a rare character or a unique string of characters like a double comma (,,
) at the end of each line and using that rare character/string of characters as your separator in split(). If you do decide to move all of your responses to one file, make sure that each line has the same character/string of characters at the end.
Assuming you move all responses to one file, the command response should look something like this:
$(eval a="$(urlfetch json https://pastebin.com/raw/FOOrBARj)".split("separator");a[Math.floor(Math.random()*a.length)])
Where separator
is replaced by your rare character/string of characters separator.