NightDev Community Forums

Command not working with Timer

I’m having an odd issue with a command I had developed for my channel. The command consists of two parts, one that is pulling data from some random text files (like the 8 ball commands) as I’d found on some various forums.

So the first command “botrandomso” is pulling from a list of items to pull the name of a random streamer.

$(eval a="$(urlfetch https://pastebin.com/raw/LBv1Y6gG)".split(";"); b="$(urlfetch https://pastebin.com/raw/6L87pF7w)".split(";"); c="$(urlfetch LINK CAN’T ADD BECAUSE OF LIMIT)".split(";"); z=a.concat(b,c); z[Math.floor(Math.random() * (z.length-1))]:wink:

This is then calling a second command, “randomso,” which looks like this:

YOUR MISSION - follow this amazing music streamer: $(twitch $(query) “{{displayName}} over at {{url}} - they were last streaming {{game}}”). Over and out, agent!

So when I manually enter the command in the chat it works fine.

However I created a timer to do this randomly, so it would fire every 30 minutes and pull a random music streamer. Nothing I’ve done in the timer seems to make it work, it always comes back with “Unknown Twitch Channel.”

Troubleshooting I’ve tried:

  • Just calling the original “botrandomso” command - however you cannot use a timer/alias to call an alias.

*Directly adding the code into the timer doesn’t work.

*Adding an “@” before the random code to see if that would fix it.

*Adding a space before the random code to see if that would fix it.

Any other things I can do or do the timers work differently than just manually calling a command? Or is there an easier way to create it so that it randomly pulls from an expandable list of documents that I’ll be using to add channels?

You might just be going over the limit of nesting, which generates an obscure error. To get this working you probably need to get rid of this extra level of nesting, which can be achieved by simplifying the code to use 1 request. You just need to put all the streamer names in a single file.

YOUR MISSION - follow this amazing music streamer: $(twitch $(eval const users = `$(urlfetch https://pastebin.com/raw/LBv1Y6gG)`.split(';'); users[Math.floor(Math.random() * users.length)]) "{{displayName}} over at {{url}} - they were last streaming {{game}}")

Got it - and the file is limited to 400 characters so essentially you can’t make “infinite” type commands like that I take it?

Hiya, if you add json in front of the urlfetch, it will avoid the character limit:
$(urlfetch json https://...).