Help? adding a user to a pastebin if they land on 100% in a 1-100 RNG

Im a Mod for a twitch channel and im wondering if a command can add the users name to a pastebin behind the scenes if they hit a specific number on a RNG command.

ex. TheShreddingMonkey: !roll
nightbot:(if 100) Welcome to the club! (then adds my username to a pastebin list)
Then I can do another command like !rngods or something and itll post a link to that pastebin in chat.

You can’t really do that with pastebin but you can definitely do that with the qoute api. I’ll write you up the commands if you want when I’m able to.

that would be awesome, thanks a ton for offering to do that :slight_smile:

Generate your public and private token here:
https://twitch.center/customapi/quote/generate

This should do the trick:

!roll

$(eval a=Math.floor(Math.random()*100+1);if(a==100){b=`Private_Token&data=$(user) ${a}`}else{b=`No ${a}`};b)

set alias to _roll

_roll

$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(1))`;b=$(2);if(b==100){c=`Welcome to the club`}else{c=`You rolled a ${b}.`};c)

Optimal command to view the list called whatever you want:

!addcom !Command_Name Cool people list: https://twitch.center/customapi/quote/list?token=Public_Token&no_id=1

I have not tested this so if there’s any issue let me know.

1 Like

Do you need to be the streamer to add this?

It works perfectly. I do have one question though, how do I get it to include the user in the answer so I know who rolled the number. On the chance that two people both do the command near same time, I wouldnt know whos command went through. I’ve tried adding ${user} in parts of the command but cant get it right.

Technically no but I would highly suggest adding it through the dashboard so your token doesn’t get taken

I see, thanks for the info. and yea i did add it through dashboard.

Change _roll to this:

$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(1))`;b=$(2);if(b==100){c=`$(user) welcome to the club`}else{c=`$(user) rolled a ${b}.`};c) 

The words inside the qoutes after c= are the two responses.

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