If/else with $(eval)


#1

I noticed you can use javascript with $(eval) however I can’t figure out how to do it with if/else. I’m trying to make a cheesy dadbot command where if you say Im dad, it responds with ‘No you’re not, you’re $(user).’ and if you say anything else following Im that isnt dad it responds with ‘Hi $(query), I’m Dad!’

Im is the command name.
If somebody could help me out I’d appreciate it.


#2

I assume you want the response for “Im dad” to be “No you’re not, you’re $(user).” regardless of how the letter casing of ‘dad’ is, so I set up a case-insensitive search for whether $(query) = dad. Just copy and paste the following into your chat:

!addcom -cd=5 Im $(eval a=decodeURIComponent("$(querystring)");a.toLowerCase()=="dad"?"No you’re not, you’re $(user).":"Hi "+a+", I’m Dad!")


#3

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