This is what I have for adding commands. It is Twitch mod only but that can be removed. also, instead of using ! for the identifier, it uses #. So it would be #add !ex This is example text.
Code:
;----------------
;| Mod Commands |
;----------------
on *:text:#*:#: {
  if (ismod) {
    if ($1 == #add) {
      if ($0 < 3) { msg # Insufficient parameters: Use #add !<command name> <text> | return }
      writeini -n cmds.ini $+(#,.,$2) text $3-
      /msg # go away
    }
    elseif ($1 == #lock) {
      if ($0 < 2) { msg # Insufficient parameters: Use #lock !<command name> | return }
      writeini -n cmds.ini $+(#,.,$2) lock 1
      /msg # Command $2 has been locked. This is irreversable. Please contact Matt/LTM to have it unlocked.
    }
    elseif ($1 == #edit) {
      if ($0 < 3) { msg # Insufficient parameters: Use #edit !<command name> <text> | return }
      var %lock $readini(cmds.ini,$+(#,.,$2),lock) 
      if (%lock == 1) {
        /msg # Can not edit locked messages.
      }
      else {
        writeini -n cmds.ini $+(#,.,$2) text $3-
        /msg # Edited $2 to $3-
      }
    }
    elseif ($1 == #delete) {
      var %lock $readini(cmds.ini,$+(#,.,$2),lock) 
      if (%lock == 1) {
        /msg # Can not remove locked messages.
      }
      else {
        /remini cmds.ini $+(#,.,$2)
        /msg # Command $2 has been removed.
      }
    }
  }
  else {
    /msg # $nick $+ , you do not have permission to use mod commands.
  }
}