blake wrote:Can someone help me with this i want to be able to add users to my bot simply using a
bind msg A|A addhuser cmd:addhuser
This should then add a user to the eggdrop with flags +fh
it should also be able to delete a user using the same proccess
such as
bind msg A|A deluser cmd:deluser
Code: Select all
bind msg "A|A" "addhuser" cmd:addhuser
bind msg "A|A" "deluser" cmd:deluser
proc cmd:addhuser { nick uhost handle text } {
if {[adduser [lindex [split $text] 0] [lindex [split $text] 1] ] } {
putserv "privmsg $nick :Added [lindex [split $text] 0] [lindex [split $text] 1]"
#remove default flag(s)
chattr [lindex [split $text] 0] -[chattr [lindex [split $text] 0]]
#add flags fh
chattr [lindex [split $text] 0] +fh
putserv "privmsg $nick : flags for [lindex [split $text] 0] are [chattr [lindex [split $text] 0]]"
} else {
putserv "privmsg $nick :That handle already exists"
}
}
proc cmd:deluser { nick uhost handle text } {
if {[deluser [lindex [split $text] 0]]} {
putserv "privmsg $nick :Deleted [lindex [split $text] 0] "
} else {
putserv "privmsg $nick :User does not exist"
}
}
Give that a test run.
There are probably some niceties that could be added to it - perhaps someone will comment.
Regarding the flags A|A in the binds -- I did it that way, because that is what you asked.
But the msg bind doesn't depend on a channel. So if you assign a user the A flag, only as some channel flag, ... I'm not sure what will happen... I haven't tested that circumstance... I'll leave that to you to discover.
Again, perhaps someone else can comment, to let you know what to expect.
I did a couple quick tests, using the global A flag, and they worked.
/msg botnick addhuser billybob *!*
what@nowhere.here.com
and
/msg botnick deluser billybob
I have tried many other scripts and tried on numerouse accasions to script it my self without any luck
thanks in advance
If you'd like to post what you attempted, I'm sure somebody here can spot what went wrong for you.
I hope this helps.