Need help for a Love/Hug command please

Asked Jul 23, 2020·10 replies·Last activity 6 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

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 ^^

10 replies

"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} !

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

Sans_titre.png

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

Sans_titre1.png

Hey @Crimson Lizard!

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).

Didn't find your answer? The community is on Discord.

Ask on Discord