Nightbot If argument

Asked Aug 11, 2020·11 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.

So I'd like to get help with a command i came up with.
It would be , if a pecific user types something then nightbot responses.
Example :
If @member types Hi , then nightbot answers with something
If @member types Hi, nightbot doesnt answers

11 replies

Yes this is possible using the following command setup:

!addcom Hi $(eval `$(user)`==`nightbotfriend`?`RESPONSE`:` `)

Hope this helped 🙂

1 More thing , can you make it so if the pecific types in it says that , but if other types it then it answers something else :D
example :
if <importantperson> types Hi , nightbot answer hello , but if someone else says hi , nightbot answers Greetings
Do u get it what i mean ? :O

Yes just do this:

!addcom Hi $(eval `$(user)`==`nightbotfriend`?`RESPONSE1`:`RESPONSE2`)

Response 1 is what “nigtbotfriend” gets.
Response 2 is what everyone else gets.

And can there be 2 names like
!addcom Hi $(eval $(user)==guy1;guy2?RESPONSE1:RESPONSE2)

the best way to do that would be like this:

!addcom Hi $(eval `$(user)`==`USER1`?`RESPONSE1`:`$(user)`==`USER2`?`RESPONSE1`:`RESPONSE2`)

Note: type the usernames in all lowercase for it to work properly also no “@“ symbol.
There are other ways to add more users but this way is simplist since you only have 2 users.

Hey there !

I really appreciate your work , and I would like to have 1 more request !

Can you make that command to 4-5 user please ?

That would be my last one to you :D

Ok this should work:

$(eval a=["$(user)"];b=["USER1","USER2","USER3","USER4","USER5"];function compare(a) {return a.some(item=>b.includes(item))};compare(a)?"Response1":"Response2")

Obviously type the user names in all lowercase. And response 1 is what it says if one of them uses it.

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

Ask on Discord