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.

Auto-Modifier public commands and channel specification.

General support and discussion of Eggdrop bots.
Post Reply
r
rewt
Voice
Posts: 1
Joined: Sat Mar 24, 2012 12:38 pm

Auto-Modifier public commands and channel specification.

Post by rewt »

I have been attempting to set up Auto-Op, Auto-Halfop, Auto-Voice commands and after scrounging through the archive and a little modification I am using the following:

Code: Select all

bind pub m|m .ao autooppub

proc autooppub {nick uhost handle chan arg} {
 set handle [lindex $arg 0]
 set hostmask [lindex $arg 1]
 if {[validuser $handle]} {
  chattr $handle +ao
  puthelp "privmsg $chan :$nick: User has been auto-op'd."
  return 0
 }
 if {![validuser $handle]} {
  puthelp "privmsg $chan :$nick: User does not exisit in my database."
  return 0
 }
}
Which has worked great for modifying user attributes across the board, I am having trouble limiting them to a specific channel however. For example, when I add the $chan var after the flags I would expect it to assign those flags to the channel pulled from the public command, however it just adds it to the users global rights.

Code: Select all

  chattr $handle +ao $chan
I even tried hard-coding a channel name and got the same result. I am a little new to tcl scripting, if someone could help correct my syntax or explain what I am doing wrong, I would greatly appreciate it.

Basically, I just don't want the auto-voiced/halfop'd/op'd users to have that access on all my bots chans :). Thanks in advance.
w
willyw
Revered One
Posts: 1202
Joined: Thu Jan 15, 2009 12:55 am

Re: Auto-Modifier public commands and channel specification.

Post by willyw »

rewt wrote:

Code: Select all

  chattr $handle +ao $chan
Try:

Code: Select all

chattr $handle -|+ao $chan
Also, please note -
This is not good:

Code: Select all

set handle [lindex $arg 0] 
lindex is for working on a tcl list, and the value in your variable is not a list. You are "getting away with it". :)

Try:

Code: Select all

set handle [lindex [split $arg] 0] 
Reference:
http://www.peterre.info/characters.html

(worth bookmarking)
Post Reply