Trying to make a custom funny command.
2 pastebins, in each pastebin contains a lot of strings(for test there are only 3 strings in each pastebins).
Overall, all works, but sometimes Nightbot returns “undefined” or even nothing
Here is a command
$(eval r = (a) => a[Math.floor(Math.random() * a.length - 1)]; s = (s) => s.split(
#
); i = s($(urlfetch json https://pastebin.com/raw/dWVGj6sP)
); j = s($(urlfetch json https://pastebin.com/raw/n9FjG8bS)
);$(user) ${r(i)}, $(touser) ${r(j)}
; )
(Add a space before last “)” because “;)” is a smile, in original there is no space
Here is a pic with some results
Zero ideas what’s the problem.
P.S. also, i change all strings in both pastebins to English, but in original all strings are on a different language. In English Nightbot never return nothing, but on russian - sometimes he does.
P.P.S. both pastebins have space in the end of the line after symbol “#”, i tried to remove them and remove “-1” after “a.length”, but it doesn’t help