Help with a lottery command.

Hi all, I am trying to add a command that will give 250 points of nightbots currency away randomly however for some reason it does not work.

I currently have this:

!addcom !lottery !give $(urlfetch https://2g.be/twitch/randomviewer.php?channel=zed_b0t) 250

It will return " !give zed_b0t 250" but not function.

If I try to do !addcom !lotterytest !give Zed_b0t 250 and hard code it then it will return !give zed_b0t 250 but will also function.

My only thought is that it is executing the give function/call before the variable is resolved but I am not sure how to resolve that.

Hey @zed_b0t!

Nightbot has no currency system, so I’m not sure what you’re referring to.

I want nightbot to use the command in chat to give currency from a different system. Nightbot gathers currency from being in the chat and can give it away with !give $User $amount .

When the user is hard coded in as a set string, it works completely fine. But when I use a random viewer variable it doesn’t work. I can set up a test and link to my chat so people can observe results or record a video explanation if that helps.

Okay, now I understand what you mean. It’s weird it doesn’t work when the user is randomly picked, but it does when it’s hard-written. There shouldn’t be any difference. I suggest to make sure the second bot doesn’t require usernames to be formatted the same way they are in chat, or check if it has a cooldown on the command. But given that from what it seems like, the issue isn’t on Nightbot’s side, we can’t do much to help, I suggest contacting the support of the other bot.

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