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 

Join ban depending on gender

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


Joined: 03 Mar 2014
Posts: 5

PostPosted: Mon Mar 03, 2014 7:32 pm    Post subject: Join ban depending on gender Reply with quote

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
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Mar 03, 2014 11:33 pm    Post subject: Re: Join ban depending on gender Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Mar 04, 2014 2:49 am    Post subject: Reply with quote

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
View user's profile Send private message
AlexF
Voice


Joined: 03 Mar 2014
Posts: 5

PostPosted: Tue Mar 11, 2014 11:12 am    Post subject: Reply with quote

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