This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

$botnick command

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
D
Danik
Halfop
Posts: 49
Joined: Sun Jun 15, 2008 12:59 pm
Location: Moldova
Contact:

$botnick command

Post by Danik »

does anybody know (code) how can I make the egg to respond on commands like: botnick op, botnick voice .... instead of !op and !voice
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

Code: Select all

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 :D
[/code]
Last edited by Nimos on Wed Jan 07, 2009 7:03 am, edited 1 time in total.
D
Danik
Halfop
Posts: 49
Joined: Sun Jun 15, 2008 12:59 pm
Location: Moldova
Contact:

Post by Danik »

something is wrong ... it doesn't work .

I've added this command in my lol script and it dowsnt respond on commands

Code: Select all

bind pub o|o .op pub_lol_op
bind pub o|o "$botnick op" pub_lol_op
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

I dont know lol script, but your new bind has 2 words instead of one, thats the problem^^
D
Danik
Halfop
Posts: 49
Joined: Sun Jun 15, 2008 12:59 pm
Location: Moldova
Contact:

Post by Danik »

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
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

try without the asterisk then...that was for pubm bind only
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Thats the wrong way to go about it, use something like this:

Code: Select all

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
D
Danik
Halfop
Posts: 49
Joined: Sun Jun 15, 2008 12:59 pm
Location: Moldova
Contact:

Post by Danik »

I just need the code to replace this

Code: Select all

bind pub o|o .op pub_lol_op 
with the: botnick op.

because i use the lol script
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

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 -.-
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

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: Select all

"<command>" {
             ....
         }
With:

Code: Select all

"<command>" {
             catch {procname $nick $host $hand $chan $arg}
         }
For exampe, for op:

Code: Select all

"op" {
             catch {pub_lol_op $nick $host $hand $chan $arg}
         }
r0t3n @ #r0t3n @ Quakenet
Post Reply