mIRC Homepage
Posted By: AlphaKennyHuan Twitch IRC bot Help - 02/11/13 01:39 PM
I was just wondering is there a way to make a command, that wehn used makes a new command, for example "!command new (name of command here)=(What the command will say)", so if i said "!command new !happy=/me is now happy", it would make that command
Posted By: Skullmonkey Re: Twitch IRC bot Help - 02/11/13 08:25 PM
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.
  }
}
Posted By: AlphaKennyHuan Re: Twitch IRC bot Help - 03/11/13 09:28 PM
Thank you but this did not work for me, firstly when i did it it just said back to me go away, but then even when i tried to use the command nothing happened, then i thought it might be because of the new file that it made, the cmds.ini file, so i tried to load that, but when that was in mIRC nothing came up in it, but when i opened the file it said

[#allsport54.!test]
text=This is a Test
Posted By: Skullmonkey Re: Twitch IRC bot Help - 04/11/13 12:22 AM
Haha I thought I edited the go away thing before I posted it.

Try this
Code:
on *:text:!*:#: {
  var %get $+(#,.,$1)
  var %name $1
  var %text $readini(cmds.ini,%get,text)
  if (!%text) {
    /msg # No such command available.
  }
  else {
    if (%flood3) { return }
    set -u30 %flood3 On
    /msg # %text
  }
}

;----------------
;| 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 # $2 command added as $3-
    }
    elseif ($1 == #edit) {
      if ($0 < 3) { msg # Insufficient parameters: Use #edit !<command name> <text> | return }
      writeini -n cmds.ini $+(#,.,$2) text $3-
      /msg # Edited $2 to $3-
    }
    elseif ($1 == #delete) {
      /remini cmds.ini $+(#,.,$2)
      /msg # Command $2 has been removed.
    }
  }
}
else {
  /msg # $nick $+ , you do not have permission to use mod commands.
}

It adds the bit where it looks for the ! at the beginning of text and then compares it with the command. I thought you had this already but I guess not.

If the wording is not to your liking, you can always edit it.
Posted By: AlphaKennyHuan Re: Twitch IRC bot Help - 04/11/13 06:52 PM
okay thank you soo much i will test it right now

EDIT: just tested it works great thanks
© mIRC Discussion Forums