| View previous topic :: View next topic |
| Author |
Message |
Danik Halfop
Joined: 15 Jun 2008 Posts: 49 Location: Moldova
|
Posted: Mon Jan 05, 2009 4:15 pm Post subject: $botnick command |
|
|
| does anybody know (code) how can I make the egg to respond on commands like: botnick op, botnick voice .... instead of !op and !voice |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Tue Jan 06, 2009 5:07 pm Post subject: |
|
|
| Code: |
bind pubm o|o "$botnick op *" pubm:op
proc pubm:op {nick host hand chan text} {
set target [lindex [split $text] 2]
pushmode $chan +o $target
}
|
if you know a very little about scripting, you could write the other commands by editing this template
[/code]
Last edited by Nimos on Wed Jan 07, 2009 7:03 am; edited 1 time in total |
|
| Back to top |
|
 |
Danik Halfop
Joined: 15 Jun 2008 Posts: 49 Location: Moldova
|
Posted: Wed Jan 07, 2009 6:18 am Post subject: |
|
|
something is wrong ... it doesn't work .
I've added this command in my lol script and it dowsnt respond on commands
| Code: |
bind pub o|o .op pub_lol_op
bind pub o|o "$botnick op" pub_lol_op |
|
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Wed Jan 07, 2009 7:05 am Post subject: |
|
|
| I dont know lol script, but your new bind has 2 words instead of one, thats the problem^^ |
|
| Back to top |
|
 |
Danik Halfop
Joined: 15 Jun 2008 Posts: 49 Location: Moldova
|
Posted: Wed Jan 07, 2009 7:08 am Post subject: |
|
|
| Nimos wrote: | | I dont know lol script, but your new bind has 2 words instead of one, thats the problem^^ |
i just replaces: !op with "$botnick op *" .. and nothing hapens |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Wed Jan 07, 2009 7:19 am Post subject: |
|
|
| try without the asterisk then...that was for pubm bind only |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Wed Jan 07, 2009 9:02 am Post subject: |
|
|
Thats the wrong way to go about it, use something like this:
| Code: | bind pubm o|o {*} bot:cmds
proc bot:cmds {nick host hand chan text} {
global botnick
if {![string equal -nocase $botnick [lindex [split $text] 0]]} { return }
set cmd [lindex [split $text] 1]
set arg [join [lrange $text 2 end]]
switch -exact -- $cmd {
"op"
set who [lindex [split $arg] 0]
if {![onchan $who $chan]} {
putserv "NOTICE $nick :ERROR: $who is not on $chan."
} elseif {![botisop $chan]} {
putserv "NOTICE $nick :ERROR: I require op to do that!"
} elseif {[isop $who $chan]} {
putserv "NOTICE $nick :ERRRR: $who is already op on $chan."
} else {
putserv "MODE $chan +o $who"
putserv "NOTICE $nick :Done. Op'd $who on $chan."
}
}
"deop"
set who [lindex [split $arg] 0]
if {![onchan $who $chan]} {
putserv "NOTICE $nick :ERROR: $who is not on $chan."
} elseif {![botisop $chan]} {
putserv "NOTICE $nick :ERROR: I require op to do that!"
} elseif {![isop $who $chan]} {
putserv "NOTICE $nick :ERRRR: $who is not op'd on $chan."
} else {
putserv "MODE $chan -o $who"
putserv "NOTICE $nick :Done. Deop'd $who on $chan."
}
}
"default" {
putserv "NOTICE $nick :SYNTAX: $botnick <command> ?arguements?"
putserv "NOTICE $nick :Available commands: op|deop."
}
}
}
putlog "Loaded botnick commands!"
|
This is untested, just an example to show you how to do it.. _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
Danik Halfop
Joined: 15 Jun 2008 Posts: 49 Location: Moldova
|
Posted: Wed Jan 07, 2009 11:04 am Post subject: |
|
|
I just need the code to replace this
| Code: | | bind pub o|o .op pub_lol_op |
with the: botnick op.
because i use the lol script |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Wed Jan 07, 2009 3:40 pm Post subject: |
|
|
bind pubm o|o "$botnick op" pub_lol_op_2
proc pub_lol_op_2 {nick host hand chan text} {
pub_lol_op "$nick $host $hand $chan [lrange [split $text] 2 end]"
}
do this for every lol script bind -.- |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Wed Jan 07, 2009 7:51 pm Post subject: |
|
|
Let me explain what i meant about going about it the wrong way.
Binding to $botnick is very well ok. but it will also error because $botnick is in the global namespace, so you need to call it via $::botnick
When your botnick changes nickname on irc, lets say from its alt-nick to its main nickname, the binds will still be bound to the alt-nick, which defeats the object of botnick commands.
Its not hard work to port lol-tools commands into my example, just reply the code inside:
| Code: | "<command>" {
....
} |
With:
| Code: | "<command>" {
catch {procname $nick $host $hand $chan $arg}
} |
For exampe, for op:
| Code: | "op" {
catch {pub_lol_op $nick $host $hand $chan $arg}
} |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
|