Creating a bet command

I run channels for a Zelda randomizer, and we like people to bet what an item is going to be. So I created a command listed as !startbet using the $(query) variable. So if I type !startbet Where are Light Arrows? it returns “Place your bets using the command “!bet”. The bet is for: $(query)”

The !bet is just what makes it easy for me to see the bets from the other messages. So I can type their names and their bets separately on a notepad and save it until the item is found.

The problem I’m having is a !betwinner command. I have it set to !betwinner followed by the username and then their message.

I want it to say “The winner of the bet is $(touser) . The winning bet was (their message) .” But I can’t figure out how to skip the username part and just put the remainder of what I type as their message. For example:

!betwinner JasonArilani Goron City
would return
“The winner of the bit is JasonArilani. The winning bet was Goron City”

Is there a way to do this?
Am I overcomplicating a lot of this?
Is there an easier way to do any of these commands? (!startbet, !bet, !betwinner)
Just started out with Nightbot and have enjoyed using it thus far. Just want to get this command to work.

A fix for !betwinner which has some eval to separate the 1st word from the rest of the input.

$(eval a=decodeURIComponent(`$(querystring)`).split(` `);a.length>=2?(b=a.shift(),`The winner of the bet is ${b}. The winning bet was ${a.join(` `)}.`):`Missing input!`)

That did what I was looking for! Thank you so much!

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