egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

add delete user

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Mon Aug 02, 2010 1:30 pm    Post subject: add delete user Reply with quote

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

I have tried many other scripts and tried on numerouse accasions to script it my self without any luck
thanks in advance
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Aug 02, 2010 8:10 pm    Post subject: Re: add delete user Reply with quote

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:

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. Smile

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


Quote:

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.
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Tue Aug 03, 2010 1:33 pm    Post subject: Reply with quote

Thanks willyw, I have added to this so that i can add different flags for differnet users allowing some users commands that others dont this will kind of correspond with my post on eggdrop help could this be changed so it sends the adduser command then will do the chattr flags

Code:
bind msg "A|A" "addhalfop" cmd:addhalfop
bind msg "A|A" "delhalfop" cmd:delhalfop

proc cmd:addhalfop { 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 fhp
         chattr [lindex [split $text] 0] +fhp

         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:delhalfop { 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"
           }
}

bind msg "A|A" "addop" cmd:addop
bind msg "A|A" "delop" cmd:delop

proc cmd:addop { 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 fhop
         chattr [lindex [split $text] 0] +fhop

         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:delop { 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"
           }
}

bind msg "A|A" "addadmin" cmd:addadmin
bind msg "A|A" "deladmin" cmd:deladmin

proc cmd:addadmin { 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 fhopAS
         chattr [lindex [split $text] 0] +fhoAS

         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:deladmin { 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"
           }
}

bind msg "A|A" "addsenior" cmd:addsenior
bind msg "A|A" "delsenior" cmd:delsenior

proc cmd:addsenior { 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 fhSop
         chattr [lindex [split $text] 0] +fhoSp

         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:delsenior { 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"
           }
}


Thanks
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber