| View previous topic :: View next topic |
| Author |
Message |
AlexF Voice
Joined: 03 Mar 2014 Posts: 5
|
Posted: Mon Mar 03, 2014 7:32 pm Post subject: Join ban depending on gender |
|
|
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 |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Mar 03, 2014 11:33 pm Post subject: Re: Join ban depending on gender |
|
|
Try this:
| Code: |
# 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. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Mar 04, 2014 2:49 am Post subject: |
|
|
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: |
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. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Mon Mar 23, 2015 11:52 am; edited 1 time in total |
|
| Back to top |
|
 |
AlexF Voice
Joined: 03 Mar 2014 Posts: 5
|
Posted: Tue Mar 11, 2014 11:12 am Post subject: |
|
|
| Thanks both. |
|
| Back to top |
|
 |
|