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.
Help for those learning Tcl or writing their own scripts.
darton
Op
Posts: 155 Joined: Sat Jan 21, 2006 11:03 am
Post
by darton » Sat Mar 25, 2006 10:16 am
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?
Winters
Voice
Posts: 29 Joined: Sat Jul 09, 2005 12:24 pm
Post
by Winters » Sat Mar 25, 2006 10:52 am
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} {
darton
Op
Posts: 155 Joined: Sat Jan 21, 2006 11:03 am
Post
by darton » Sat Mar 25, 2006 11:31 am
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.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sat Mar 25, 2006 5:55 pm
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 .
Winters
Voice
Posts: 29 Joined: Sat Jul 09, 2005 12:24 pm
Post
by Winters » Sat Mar 25, 2006 9:17 pm
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!"
}
darton
Op
Posts: 155 Joined: Sat Jan 21, 2006 11:03 am
Post
by darton » Sun Mar 26, 2006 4:06 pm
Thank you guys.