mIRC Homepage
Posted By: BullD0G add command - 26/02/15 09:05 PM
Currently trying to make it so my mods or my self can add text commands via my bot so i dont have to add code. So like
!addcommand !test This is a test
and then someone types !test and the bot replys with This is a test.

This is what I have but it but when go to have to bot reply it doesn't

Quote:
on $*:text:/^!addcommand !?(\S+)/iS:#:{
if ($nick !isop #) return
writeini commands.ini commands $regml(1) $$3-
.msg $chan Command has been added!
}
Posted By: Sjoepele Re: add command - 27/02/15 05:46 AM
Im not sure about regex but i always just used something like

Code:
on *:text:!addcom *:#:{
if ($nick isop #) {
if ($readini(commands.ini,commands,$2) >= 1) { msg # this command already exists | return }
writeini commands.ini commands $2 $3-
msg # command $2 added!
 }
}


And to check for commands something like
Code:
on *:text:!*:#:{
  if ($readini(commands.ini,commands,$1) != $null) {
    msg # $readini(commands.ini,commands,$1)
  }
}
Posted By: BullD0G Re: add command - 27/02/15 04:01 PM
Yeah after a few dabbles i figured it out with this code

Quote:
on $*:text:/^!addcommand !?(\S+)/iS:#: {
if ($nick !isop #) return
writeini commands.ini commands $regml(1) $$3-
msg $chan /me The command $2 has been added.
}


for some reason it isnt showing the spaces but on the if command and remini there should be a space
© mIRC Discussion Forums