If/Else clauses

Is it possible to add an If/Else clause within a command. I.e. if $(touser)=none then … else …

Cheers in advance!

you can do so via the $(eval) variable. You can execute javascript to use the if else’s with.

https://docs.nightbot.tv/commands/variables/eval

If you don’t know javascript you can tell me what you want and i or someone else can make a command that does it. So perhaps you could from it

I’m literally after a command that would say if $(touser) is this person then editcom so !partner= there’s no partner, else editcom so current partner is $(touser)

the command at present is:

!commands add !setpartner -ul=mod -a=!commands edit !partner The current carry partner is $(touser), check them out at twitch.tv/$(touser)

I need to apply if/else to setpartner so it changes partner accordingly

I don’t know javascript unfortunately.

what you want is possible, but very much a hack:

!commands add .partner -ul=mod The current carry partner is $(touser), check them out at https://www.twitch.tv/$(touser)
!commands add !partner -ul=mod -a=.partner $(eval const channel = decodeURIComponent($(querystring)); channel === 'undefined' ? 'default_channel' : channel)
!commands add !setpartner -ul=mod -a=!commands edit !partner $(eval const channel = decodeURIComponent($(querystring)); '$' + '(eval const channel = decodeURIComponent($' + `(querystring)); channel === 'undefined' ? '${channel}' : channel)`)
1 Like

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