Need help for a Love/Hug command please

Hello,
i took example from an existing love command to create a hug command and add a third part.
initialy the command works with 2 options.
!hug streamer - special message for streamer
!hug - random viewers

and i try to add !hug viewer

$(eval if ("$(query)" == “streamer”) { var hugMessage = "streamer you’re amazing ! Big hugs PrideKoala we love you LuvSign LuvHearts ";} else if { var hugMessage = “$(user) hugged $(urlfetch https://decapi.me/twitch/random_user/kempolajuwon) PrideKoala " ;} else { var hugMessage = " $(user) hugged $(query)!”;} hugMessage; )

but i got this error : Unexpected token ‘{’

Sorry everything is new for me,it’s still hard to understand what i am doing ^^

“else if” requires a condition to check, just like “if”. I added a condition for it, checking for empty input.

$(eval q=decodeURIComponent("$(querystring)");if(q == "streamer"){"streamer you’re amazing! Big hugs PrideKoala we love you LuvSign LuvHearts";}else if(!q){"$(user) hugged $(urlfetch https://decapi.me/twitch/random_user/kempolajuwon) PrideKoala";}else{"$(user) hugged "+q+"!";})

thank you for your answer.
but i got this error when i try to !hug someone
i get this :
Kempolajuwon hugged ${q} !

Fixed, should work now.

thank you so much Roketto,i wish you a good day

Hello sorry to comeback to you but for some reason the !hug command only select the bots

I see 3 different users being selected in that screenshot? But it’s all random so yeah it is possible that a bot is selected multiple times in a row.

yesterday we were around 40-60 viewers during the stream and everytime people used !hug ,it selected the bots isaacracingplus,nightbot or streamelement

Hey @Kempolajuwon!

Sometimes when systems are perfectly random they look not random at all, that’s the case here.
It’s a commonly known issue.

we tried yesterday again during live,everyone spamming !hug and it’s always selected bots streamelement,nightbot or isaacracingplus.
Never selected a viewer.

Yeah, yeah, I heard that already…
Replace the URL in $(urlfetch) by the following:

https://decapi.me/twitch/random_user/$(channel)?exclude=nightbot,streamelements,isaacracingplus

You can exclude more people by adding them to the list, just separate each name by a , (comma).

2 Likes

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