NightDev Community Forums

Love command not case sensitive


#1

Hi,

I have this love command:
$(eval if ("$(query)" == “Haga”) { var loveMessage = “The love you have for our streamer is endless!!”; } else { var loveMessage = “There is $(urlfetch https://beta.decapi.me/random/number/0/100)% <3 between $(user) and $(query)!”; } loveMessage; )

But it is case sensitive, i would like som help to get it to not be case sensitive
Where Haga is the name of the streamer iam helping


#2

@robepower Make “$(query)” and “Haga” lowercase and compare those strings. Also you can use Math.random to get random numbers. Try this:

$(eval a=decodeURIComponent(`$(querystring)`);a.toLowerCase()==`haga`?`The love you have for our streamer is endless!!`:`There is `+Math.floor(Math.random()*101)+`% <3 between $(user) and `+a+`!`)

#3

Okay so just to check that iam understanding.

i edit the !love command so that it contains your answer?
Or should i have anything more?
iam kind of new to this custom commands stuff but i like to play around with it :slight_smile:

so the command looks like this?
!commands edit !love $(eval a=decodeURIComponent($(querystring));a.toLowerCase()==haga?The love you have for our streamer is endless!!:There is+Math.floor(Math.random()*101)+% &lt;3 between $(user) and+a+!)
?
sorry if i ask noob questions but as i said iam fairly new to this custom commands stuff,
But i apreciate all help i can get


#4

Copy and paste this into chat:

!commands edit !love $(eval a=decodeURIComponent(`$(querystring)`);a.toLowerCase()==`haga`?`The love you have for our streamer is endless!!`:`There is `+Math.floor(Math.random()*101)+`% <3 between $(user) and `+a+`!`)

#5

Ah, thanks now it works as i want, thank you
but now when i test !love another user in the stream the respond gets wierd?

There is 91% &lt;3 between Robepower and HapptrixX!

did i do something wrong?


#6

Something went wrong with my message. It’s been fixed. Copy and paste that line of code into your chat again.


#7

Yes Not it works perfect,
Thanks for the quick help :slight_smile:


#8

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