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.

Give op on special text

Help for those learning Tcl or writing their own scripts.
Post Reply
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Give op on special text

Post by darton »

Hello!
I want to make my bot to give me op when I send it a special message. For example I type: "/msg Bot opme".

Code: Select all

bind msg - opme aop_op
proc aop_op {nick host hand chan text} {
pushmode $chan +o $nick
return 0
} 
But when I send a private message, in the party-line of the bot appears an error: Tcl error [aop_op]: wrong # args: should be "aop_op nick host hand chan text"
Whats's wrong?
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

Code: Select all

MSG
         bind msg <flags> <command> <proc>
         procname <nick> <user@host> <handle> <text>

         Description: used for /msg commands. The first word of the user's
           msg is the command, and everything else becomes the text argument.
:> just change the proc with

proc aop_op {nick host hand text} {
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

When I do this the bot says: "No such variable $chan"
And when I replace $chan with the real chan and not with a variable, nothing happens.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind msg - opme opme

proc opme {nick uhost hand arg} {
 foreach chan [channels] {
  pushmode $chan +o $nick
 }
}
This will op you (or anyone) who msgs the bot opme on all channels. I suggest you change the '-' to some flag, probably o or n.
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

and if you only want to get opped in one channel then try this :)

Code: Select all

bind msg - opme opme

proc opme {nick host hand arg} {
set chan "[lindex [split $arg] 0]"
if {"$chan" == "" || ![string match "#*" "$chan"]} {
puthelp "notice $nick :Wrong Channel Synthax! Try again."
return
} elseif {![validchan $chan]} {
puthelp "notice $nick :$chan isn't in my channellist"
return
} elseif {![botisop $chan]} {
puthelp "notice $nick :I'm not opped in $chan!"
return
} elseif {[isop $nick $chan]} {
puthelp "notice $nick :You're already opped in $chan!"
return
}
pushmode $chan +o $nick
puthelp "notice $nick :Done!"
}
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

Thank you guys.
Post Reply