| View previous topic :: View next topic |
| Author |
Message |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sat Mar 25, 2006 10:16 am Post subject: Give op on special text |
|
|
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: |
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? |
|
| Back to top |
|
 |
Winters Voice
Joined: 09 Jul 2005 Posts: 29
|
Posted: Sat Mar 25, 2006 10:52 am Post subject: |
|
|
| Code: |
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} { |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sat Mar 25, 2006 11:31 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Mar 25, 2006 5:55 pm Post subject: |
|
|
| Code: | 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. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Winters Voice
Joined: 09 Jul 2005 Posts: 29
|
Posted: Sat Mar 25, 2006 9:17 pm Post subject: |
|
|
and if you only want to get opped in one channel then try this
| Code: |
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!"
} |
|
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sun Mar 26, 2006 4:06 pm Post subject: |
|
|
| Thank you guys. |
|
| Back to top |
|
 |
|