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.

add delete user

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

add delete user

Post by blake »

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
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: add delete user

Post by willyw »

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.
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

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: Select all

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
Post Reply