Command help with varying inputs

Hello! I’m trying to essentially modify the !hug command with some special actions to be a !spank command. I have figured out by using some different bits from here how to add an RNG to the command and how to hug specific users… i am guessing what i’m trying to do is doable, but I am not familiar enough with this language to figure it out myself… is there a way to include a typed number and an rng response?

For example !spank nightbot -> “geekmeow spanks nightbot x times” (with random number generated)
but i would ALSO like it to function such that !spank nightbot 4 -> “geekmeow spanks nightbot 4 times”… or whatever number is input there.

I feel like this is somewhat related to how !quote # would work, but I can’t figure out how to modify properly to include more than one query, being the username (or whatever is typed after spank) as well as the number. Or maybe I can’t, which is fine too. :stuck_out_tongue:

Currently I have: $(user) bends $(eval a=decodeURIComponent($(querystring))) over their knee and gives them $(eval Math.floor((Math.random() * 100) + 1)) good smacks.

Thank you so much!

Hey @geekmeow!

Here’s a simple way to do it:

$(eval q=decodeURIComponent(`$(querystring)`).split(` `);q.length==1?n=Math.floor(Math.random()*100)+1:isNaN(q[1])?n=Math.floor(Math.random()*100)+1:n=q[1];`$(user) bends ${q[0]} over their knee and gives them ${n} good smacks.`)

thank you so very much! that works perfectly!

1 Like

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