final and completed to my needs and sharing with you now is this unique bot commander.
like my other post, this does away with the !trigger in favour of regex and match words for the bot to work off of a /me command. this script was an accumalation of my request and debug from a very kind scripter, Jethro_ , who no doubt has algebraic headaches now from all the regex doing the code for me lol. i am deeply thankful to him and acknowledge him honestly here.
so, what can the bot do..
vop add / del , hop add / del , aop add / del , sop add / del
voice/devoice , halfop/dehalfop , op/deop , kick, ban, akick add / del
extended ban silence / unsilence , channel mode setting , mass channel modes
how to work the bot.
set your details where it says your_host/vhost (eg music@Tom.Jones.is.Welsh or jimmy@severhost.yourispdetails)
edited took some advice from another coment made on a different snippet about the danger of just using the if ($nick == mynick) check.. even with kill set to quick, a user can impersonate you for 20 secs which is more than enough time to cause issues heh.. updated to a more secure check.
in channel type in this format /me /
eg /me vop jimmy , /me set +M , /me silence timmy , /me akick jane , /me dhop a_fish_called_wanda
Mass mode part works differently to the set bit for this reason.
(1) set /me set +/- (room mode letter) eg /me set +M
(2) mode /me mode +/- (room mode letters) eg /me mode +iRSC
it is that simple.
here is the final code as tested on an unrealircd 3.2.7 server with anope services via a mirc v6.35 blank client. loads into a clean fresh remote
its as simple as that
i hope you enjoy it.
(p.s) if you want to make it ops triggerable instead of just you.. change the if ($nick == mynick) to if ($nick isop $chan)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Regex Bot commander final release ;
; Idea by Cheiron ;
; Coded by Jethro_ and debugs by bone282 ;
; and Cheiron. Please out of respect ;
; include this section when you paste in ;
; your remotes to give due where it is ;
; due and enjoy this script. Cheiron ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:ACTION:*:#: {
if ($address($nick,2) == your_host/vhost)
if ($regex($1-,/(^|\s)(kick?k?s?\s\S+)/i)) { tokenize 32 $regml(2) | kick $chan $2 }
if ($regex($1-,/(^|\s)(vop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs vop $chan add $2 }
if ($regex($1-,/(^|\s)(dvop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs vop $chan del $2 }
if ($regex($1-,/(^|\s)(hop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs hop $chan add $2 }
if ($regex($1-,/(^|\s)(dhop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs hop $chan del $2 }
if ($regex($1-,/(^|\s)(aop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs aop $chan add $2 }
if ($regex($1-,/(^|\s)(daop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs aop $chan del $2 }
if ($regex($1-,/(^|\s)(sop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs sop $chan add $2 }
if ($regex($1-,/(^|\s)(dsop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs sop $chan del $2 }
if ($regex($1-,/(^|\s)(op?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan +o $2 }
if ($regex($1-,/(^|\s)(deop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan -o $2 }
if ($regex($1-,/(^|\s)(halfop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan +h $2 }
if ($regex($1-,/(^|\s)(dehalfop?p?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan -h $2 }
if ($regex($1-,/(^|\s)(voice?e?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan +v $2 }
if ($regex($1-,/(^|\s)(devoice?e?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan -v $2 }
if ($regex($1-,/(^|\s)(set?t?s?\s[\+\-][a-zA-Z]+)/i)) { tokenize 32 $regml(2) | mode $chan $2 }
if ($regex($1-,/(^|\s)(ban?n?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan +b $address($2,2) }
if ($regex($1-,/(^|\s)(unban?n?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan -b $address($2,2) }
if ($regex($1-,/(^|\s)(akick?k?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs akick $chan add $address($2,2) }
if ($regex($1-,/(^|\s)(deakick?k?s?\s\S+)/i)) { tokenize 32 $regml(2) | cs akick $chan del $address($2,2) }
if ($regex($1-,/(^|\s)(silence?e?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan +b ~q: $+ $address($2,2) }
if ($regex($1-,/(^|\s)(unsilence?e?s?\s\S+)/i)) { tokenize 32 $regml(2) | mode $chan -b ~q: $+ $address($2,2) }
if ($regex($1-,/(^|\s)(mode?e?s?\s\w+)/i)) { tokenize 32 $regml(2) | mode $chan + $+ $right($regml(2),6-1) }
if ($regex($1-,/(^|\s)(demode?e?s?\s\w+)/i)) { tokenize 32 $regml(2) | mode $chan - $+ $right($regml(2),6-1) }
}
}
about $address($nick,2) u can put $wildsite
u can use hash tables if u want "/hadd -m name " like this
/hadd -m xcom kick kick # $2
/hadd -m xcom vop cs vop $chan add $2
for all commands.....
to remove /hdel xcom
and the code
on *:start:{ hmake xcom | if ($exists(xcom.data)) hload xcom xcom.data }
on *:exit:if $hget(xcom) { hsave xcom xcom.data | hfree xcom }
on @*:action:#:if (($wildsite == your_host/vhost) && ($hget(xcom,$1))) $($v1,2)
i have no issues with it. i did notice one very unusual thing thing though between the 2!
with the regex one... you can slip the command into a sentance, but your one .. we cant.
for example... with the regex one i can go /me ponders for a little bit and decides that we can voice timmy after all as he has earnt it.
and it will do it..
with your edit .. it wont.. it has to be a direct /me command
just found it out and surprised me :)
they both work as good as each other mind you
i have done a minor update on the check to make it a bit more secure :)
this was using his version
11<11:59am> Joins: ira`s_RPORAR
06<11:59am> Auto_Help sets mode: +v iras_RPORAR 04<11:59am> <Sleeping_On_The_Job> devoice ira
s_RPORAR
04<11:59am> Sleeping_On_The_Job devoice ira`s_RPORAR
06<11:59am> Auto_Help sets mode: -v iras_RPORAR 04<11:59am> * Sleeping_On_The_Job set +M 06<11:59am> * Auto_Help sets mode: +M 04<11:59am> * Sleeping_On_The_Job set -M 06<11:59am> * Auto_Help sets mode: -M 04<11:59am> * Sleeping_On_The_Job mode iKSMC 06<11:59am> * Auto_Help sets mode: +iSKMC 04<11:59am> * Sleeping_On_The_Job unmode iKSMC 04<12:00pm> * Sleeping_On_The_Job demode iKSMC 06<12:00pm> * Auto_Help sets mode: -iSKMC 04<12:00pm> * Sleeping_On_The_Job vop ira
s_RPORAR
04<12:00pm> Sleeping_On_The_Job dvop ira`s_RPORAR
04<12:00pm> Sleeping_On_The_Job kick iras_RPORAR 04<12:00pm> * ira
s_RPORAR was kicked by Auto_Help (Auto_Help)
i have spotted 2 main errors on both.. protection against setting things against itself (it can be made to kick itself etc) and also a security issue for people using it. i think the if ($nick isop $chan) is adequate... but not too convinced
hi
but a saw u put /me vop jimmy "/me" is ON ACTION event not ON TEXT
btw u can also do this that is an e.g if it can help u some time
on *:action:*:#:{
if $nick == yournick {
if ($strip($1) == kick) kick # $2
elseif $istok(set|mode|demode,$strip($1),124) {
var %x $iif($strip($1) != set,$iif($left($strip($1),2) == de,- $+ $2,+ $+ $2),$2)
mode # %x
}
elseif $regex($strip($1),/^(vop|dvop|hop|dhop|aop|daop|sop|dsop)\s?(\w+)?/iS) {
var %x $iif($left($regml(1),1) == d,$remove($regml(1),$v1),$regml(1)),%y $iif($left($regml(1),1) == d,del,add)
cs %x # %y $2
}
elseif $istok(akick|deakick,$strip($1),124) {
var %x $iif($left($strip($1),2) == de,$remove($strip($1),de),$strip($1)),%y $iif($left($strip($1),2) == de,del,add)
cs %x # %y $address($2,2)
}
elseif $regex($strip($1),/^(op|deop|halfop|dehalfop|voice|devoice)\s?(\w+)?/iS) {
var %x $iif($left($regml(1),2) == de,$replace($regml(1),de,-,halfop,h,voice,v,op,o),$replace($regml(1),halfop,+h,voice,+v,op,+o))
mode # %x $2
}
elseif $regex($strip($1),/^(ban|unban|silence|unsilence)\s?(\w+)?/iS) {
var %x $iif($left($regml(1),2) == un,$replace($regml(1),un,-,ban $chr(32),b,silence,b ~q:),$replace($regml(1),ban,+b $chr(32),silence,+b ~q:))
mode # %x $+ $address($2,2)
}
}
}
Final Release now updated folks. Many thanks to Jethro for whom this would not have been possible and to bone282 for the original debug. i did have to do some debugging to release this but i suspect poor Jethro had Algebraic headaches from all the regex GRINS and made a couple of rare errors. The actual code was sound.. just had to alter some of the commands that was all ( 2 x vop original) -> vop + dvop edited* , etc) very easy mistake when either tired or brain-farted from too much regex (i know i was!!)
Anyway.. i hope you enjoy this and please comment fairly .... Cheiron :)