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.

Join ban depending on gender

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
A
AlexF
Voice
Posts: 5
Joined: Mon Mar 03, 2014 7:29 pm

Join ban depending on gender

Post by AlexF »

Hi

Our website has a Flash IRC client where users select either Female or Male and then connect.

Their gender is then set as their username on IRC i.e. a Female appears as nickname!Female@hostname and a Male appears as nickname!Male@hostname.

I want to have a TCL to run on our existing bots for e.g. .chanset #Females +female or .chanset #Males +male.

In a channel with +female set then anyone who enters with the Male username will be *!*@hostname banned.

Please can someone help?

Thanks

AlexF
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: Join ban depending on gender

Post by willyw »

Try this:

Code: Select all


# March 3, 2014

# http://forum.egghelp.org/viewtopic.php?t=19637




# Example:   .chanset #channel +female
#            will cause bot to kick and ban *!Male@* , upon joining #channel

# Example:   .chanset #channel +male
#             will cause bot to kick and ban *!Female@* , upon joining #channel


# Note:  Ban will expire after 60 minutes, and bot will remove the ban.
#        Examine the script, and feel free to change ban time to whatever you like.


# Note: You should edit the ban messages.



# Reference:  http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
#             bind join
#             setudef
#             newchanban
# can all be found there.    :)

# More reference : http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm




setudef flag female
setudef flag male


bind join - "* *" ban_by_gender


proc ban_by_gender {nick uhost handle chan} {
global botnick

        if {[channel get $chan female]} {

                set user [string tolower [lindex [split $uhost @] 0] ]

                if {$user == "male"} {
                        newchanban $chan [maskhost $nick!$uhost 2] $botnick "Edit this comment" 60
                  }

           }



        if {[channel get $chan male]} {

                set user [string tolower [lindex [split $uhost @] 0] ]

                 if {$user == "female"} {
                        newchanban $chan [maskhost $nick!$uhost 2] $botnick "Edit this comment" 60
                  }
          }

 }


Tested only briefly.
You should test carefully.

I hope this helps.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I've chosen a different path by having a simple gender flag cos having two channel modes (female and male) can screw things up. By default it's disabled (set to 0), so set it to 1 for Female or 2 for Male.

Code: Select all

setudef str gender

bind join * * gender:ban

proc gender:ban {nick uhost handle chan} {
	if {[isbotnick $nick]} return
	scan $uhost {%[^@]@%s} user host
	set gender [channel get $chan gender]
	switch -- $gender {
		"1" {
			if {$user ne "Female"} {
				newchanban $chan "*!*@$host" Gender "Gender mismatch!" 60
			}
		}
		"2" {
			if {$user ne "Male"} {
				newchanban $chan "*!*@$host" Gender "Gender mismatch!" 60
			}
		}
	}
}
Edit: Fixed typo.
Last edited by caesar on Mon Mar 23, 2015 11:52 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
A
AlexF
Voice
Posts: 5
Joined: Mon Mar 03, 2014 7:29 pm

Post by AlexF »

Thanks both.
Post Reply