Different command outcome if you @ or not

So say I want to make a !slap command but where the bot reply is different if you type !slap or !slap @someone, is there a way to do this.

As an example, ‘!slap’ would see a bot reply where it was slapping a predetermined word or user. On the other hand ‘!slap @someone’ would reply by slapping the @ed person.

This command will slap the target if anything is typed after !slap:

!addcom !slap $(eval q=decodeURIComponent("$(querystring)");q?`.me slaps ${q}`:'.me slaps predetermined user')

So you can do !slap user or !slap @user

If you literally only want to slap the target if it begins with @:

!addcom !slap $(eval q=decodeURIComponent("$(querystring)");q.match(/^@/)?`.me slaps ${q}`:'.me slaps predetermined user')

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