Nightbot command with Pastebin - tagging a user

Hello,

I wanted to make a command for the streamer I mod for and use sentences from Pastebin.
Basically looking to make a compliment and roast commands. So for example a user can do
" !compliment @johnsmith " and it would pull a compliment from pastebin & tag both users in the parts from the sentences that have $user & $touser
" Sarawilson wants Johnsmith to know they look great today! "

So I’m trying to get a link made that if I have $user and $touser in my commands on the pastebin it will pull through onto command on nightbot. I did have one work for me but it seems to put " $ " infront of the usernames and when I amend the link it doesn’t work.

Needing help on how to make this link as I can’t seem to figure it out or find one similar on here.

Thank you,

Hey @lauramichellexx!

Please have a look here:

1 Like

Thank you for your reply!!

Im still struggling on how to understand this as im new! Does this mean I can use the $touser / $user in pastebin, I have to use them on the twitch chat command before hand and just use the phase in pastebin or is there a way to use this on pastebin?

Just looking to make a command were in stream we only have to do “!compliment @Johnscott” so that nightbot can pull the sentence from pastebin and it will place the users where the $touser/$user is on the sentence… if this makes sense?

So pastebin sentence would be “$user would like to let $touser know they are great!”

Then your command will be something like this:

$(eval u=`$(user)`; t=`$(touser)`; p=`$(urlfetch https://pastebin.com/raw/XXXXXXXX)`.split(`#`); p[Math.floor(Math.random()*p.length)])

And in your Pastebin you replace $(user) by u and $(touser) by t:
• either you use template literals, a combination of backticks ` and ${variables}:

`${u} would like to let ${t} know they are great!`#

• or you use strings with variables:

u + ' would like to let ' + t + ' know they are great!'#

Thanks for your quick reply!

Nightbot is not registering this command at all. I copy and pasted the link you made up for me! and made a sentence in my pastebin stating

${u} would like to let ${t} know they are awesome!`;

to try it out but it was picking up letters like " i " or " e " ? lol not sure what I have done wrong here!

Thank you for your help its really appreciated!

@Emily I have found this and tried to give this a go but still the same problem is happening with random letters appearing.

What is your command code? Please copy/paste it here, it must include the link to your Pastebin, and put 4 spaces before your code, that way it stays formatted properly. It’ll be easier for me to correct the mistakes if I can see them.

Hey!

Here is my code & the correct pastebin link for you to have a look at the pastebin to see if I need to change anything on there too.
Thank you!

!editcom !compliment $(eval user="$(user)" touser="$(touser)"; p=$(urlfetch json https://pastebin.com/raw/zDM9CAwL).split(;); p[Math.floor(Math.random()*p.length)])

Okay, so here’s the fix:

!editcom !compliment $(eval user=`$(user)`; touser=`$(touser)`; p=`$(urlfetch json https://pastebin.com/raw/zDM9CAwL)`.split(`;`); p[Math.floor(Math.random()*p.length)])

and in your Pastebin, replace $user and $touser by ${user} and ${touser} respectively, as I showed in my previous example:

${user} would like ${touser} to know that they look fantastic today!; 
${touser} is like a breath of fresh air - From ${user} x; 
${user} thinks ${touser} is one of the best troops! we love to have you here x; 
${user} thinks you're an absolute angel x;
$to user would like to give ${touser} a hug right now!;
This may sound cheesy, but on a scale from 1 to 10, ${touser} is an 11 x;
${touser}, You're like a ray of sunshine - ${user} x;
If ${touser} was a fruit, you would be a fine-apple; 
${touser}, You are more amazing than you realize. - ${user} x;
${touser}, You’re such a good friend that I’d spend all my Jose Peso's on you - ${user}; 
If ${touser} ever happened to catch fire, ${user} would be glad to pee on them.;
${touser}, If you were a booger, I’d pick you first - ${user}; 
${touser}, Out of all the people in the world... I hate you the least. - ${user} x;
${touser}, your smile is proof that the best things in life are free - ${user}; 
Everyone needs a friend like ${touser} in their life.;
${touser}, Are you a beaver? 'Cause damnnnnnnn!;
${touser} must be a banana because ${user} finds you very a-peeling.;
${touser}, I know it's cheesy, but you're really grate!

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