One Channel Ban

Do you have script in mind but no ability to make it, type in what it should do, and you might be lucky.

Re: One Channel Ban

Postby sKippah » Sat Jan 03, 2009 1:11 pm

? Sorry i dont get it ;)
sKippah
 

Re: One Channel Ban

Postby Cristian » Sat Jan 03, 2009 1:33 pm

Instead of using
Code: Select all
putquick "KICK $channel $user :$::ocb::variable::kickmsg1" -next 


you could use
Code: Select all
putquick "KICK $channel $user :You doesn´t meet our Requirements - Only [llength $channels] joined" -next


the same goes for the other kickmessage.
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: One Channel Ban

Postby sKippah » Sat Jan 03, 2009 2:06 pm

sorry, i dont get it :( maybe u can help me, also with the ban timer?! Thank you
sKippah
 

Re: One Channel Ban

Postby Cristian » Sun Jan 04, 2009 4:46 am

Notice, there is no anti join flood


OCB short for One channel ban, can be setup to ban users connected to the server for under X seconds and for users who is on X channels.

fx:
if minchannels is set to 2, and a user join #channel, the eggdrop does a whois, and finds one channel (#channel), this user will be kicked and banned.
if minchannels is set to 6, and a user join #channel, the eggdrop does a whois, and finds two channels (#channel and #channel_2), this user will be kicked and banned.
if minchannels is set to 1, and a user join #channel, the eggdrop does a whois, and finds one channel (#channel), this user will NOT be kicked and banned.



There is three channel flags, one master and two specific.

channel flag ocb - turned off this script won't run, this is the master switch.
channel flag ocb-require1 - checks for X channel on join.
channel flag ocb-require2 - checks for time connected to the server.




It also notifys a 'home' channel when a user is affected by the OCB script.

A trigger can be changed as well. - (default .ocb)

    .ocb [on] [off] [default]
    .ocb OC [on] [off] [default]
    .ocb NCU [on] [off] [default]


OC short for One channel.
NCU short for newly connected users.

Signontime is in seconds 600 = 10 minuttes and is the default time.


**NEW** The bantime is changeable too, and specified in minutes
**NEW** The exemptflags have been added so, you can add users (and yourself) and preventing the eggdrop to kick you.
**NEW** Set home for bot messages, or leave it blank to turn it off.

Have fun with the script, and please report bugs and error here at sp00fed.org.
If you have any suggestions please inform me.

Thanks.





Code: Select all
setudef flag ocb
setudef flag ocb-require1
setudef flag ocb-require2

namespace eval ocb {
   namespace eval variable {
      variable home "#home"
      variable minchannels 2
      variable trigger ".ocb"
      variable signontime 600
      variable exemptflags "nmov|nmov"
      variable bantime 10
   }

   if {[array exists hostmasks]} {
      array unset hostmasks
   }

   array set hostmasks {
      *sp00fed.org          ""
      *hostname1.net        ""
      *hostname2.com        ""
   }





   bind join - * [namespace current]::onjoin   
   bind PUB o $::ocb::variable::trigger [namespace current]::menu

   proc onjoin {nickname hostname handle channel} {
      global ocb

      if {[channel get $channel ocb]} {

         if {![isbotnick $nickname]} {
            if {![matchattr $handle $::ocb::variable::exemptflags $channel]} {
               foreach {h i} [array get ocb::hostmasks] {
                  if {[string match $h $hostname]} {
                     return
                  }
               }

               set victim [string map {"\{" "\\\{" "\\" "\\\\" "\}" "\\\}" "\[" "\\\[" "\]" "\\\]"} [string tolower $nickname]]
               set userhostname [string trim $hostname "~"]
               set channel [string tolower $channel]

               set ocb($victim) "{$victim} {$channel} {$userhostname} {0}"
               #putlog "making whois $victim "
               bind raw - {319} [namespace current]::raw319
               bind raw - {317} [namespace current]::raw317
               putquick "WHOIS [join $victim] [join $victim]"
            }
         }
      }
   }
   proc raw319 {server raw arguments} {
      global ocb
      catch { unbind RAW - {319} [namespace current]::raw319 }


      set victim [string map {"\{" "\\\{" "\\" "\\\\" "\}" "\\\}" "\[" "\\\[" "\]" "\\\]"} [string tolower [lindex [split $arguments] 1]]]
      if {[info exists ocb($victim)]} {


         set channel [join [lindex [split $ocb($victim)] 1]]
         set hostname [join [lindex [split $ocb($victim)] 2]]
         set result [join [lindex [split $ocb($victim)] 3]]
         set channels [string tolower [lrange $arguments 2 e]]

         if {[channel get $channel ocb-require1]} {

            #putlog "channels $channels"
            if {[llength $channels] < $::ocb::variable::minchannels} {
               foreach user [chanlist $channel] {
                  if {[string match "$hostname" "[string trim [getchanhost $user $channel] "~"]"]} {
                     set banmask *!*[string trim $hostname "~"]
                     set reason "You don't meet our Requirements - Only [llength $channels] Channels"
                     putquick "KICK $channel $user :$reason" -next 
                     putquick "MODE $channel +b $banmask" -next
                     newchanban $channel $banmask OCB $reason $::ocb::variable::bantime
                     if {[validchan $::ocb::variable::home]} {
                        putmsg $::ocb::variable::home "Kicked $user. Only [llength $channels] channels were were found."
                     }
                  }
                  set ocb($victim) "{$victim} {$channel} {$hostname} {1}"
               }
            }
         }
      }
   }
   proc raw317 {server raw arguments} {
      global ocb
      catch { unbind RAW - {317} [namespace current]::raw317 }
      #putlog "Arguments: $arguments"
      set victim [string map {"\{" "\\\{" "\\" "\\\\" "\}" "\\\}" "\[" "\\\[" "\]" "\\\]"} [string tolower [lindex [split $arguments] 1]]]
      if {[info exists ocb($victim)]} {
   
         set channel [join [lindex [split $ocb($victim)] 1]]
         set hostname [join [lindex [split $ocb($victim)] 2]]
         #set result [join [lindex [split $ocb($victim)] 3]]

         set signontime [lindex [split $arguments] 3]
         #putlog "Sign on time: $signontime"
         if {[channel get $channel ocb-require2]} {
            if {[expr [unixtime] - $signontime] < $::ocb::variable::signontime} {
               foreach user [chanlist $channel] {
                  if {[string match "$hostname" "[string trim [getchanhost $user $channel] "~"]"]} {
                     set banmask *!*[string trim $hostname "~"]
                     set reason "You don't meet the Requirements - Under [duration [expr [unixtime] - $signontime]] on [lindex [split $::server .] 2]"
                     putquick "KICK $channel $user :$reason" -next   
                     putquick "MODE $channel +b $banmask" -next
                     newchanban $channel $banmask OCB $reason $::ocb::variable::bantime
                     if {[validchan $::ocb::variable::home]} {
                        putmsg $::ocb::variable::home "Kicked $user. Under [duration [expr [unixtime] - $signontime]] on [lindex [split $::server .] 2]."
                     }
                  }
               }
            }
         }
      }
   }


   proc menu {nickname hostname handle channel arguments} {
      set first "[lindex $arguments 0]"
      switch $first {
         "on" {
            channel set $channel +ocb


            set status ""
            append status "(\002NCU\002) Newly connected users is "
            if {[channel get $channel ocb-require1]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }
            append status "(\002OC\002) One channel users is "
            if {[channel get $channel ocb-require2]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }

            puthelp "NOTICE $nickname :(\002OCB\002) One channel ban is turned (\002\00309ON\003\002) - $status"
         }
         "off" {   
            channel set $channel -ocb


            set status ""
            append status "(\002NCU\002) Newly connected users is "
            if {[channel get $channel ocb-require1]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }
            append status "(\002OC\002) One channel users is "
            if {[channel get $channel ocb-require2]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }

            puthelp "NOTICE $nickname :(\002OCB\002) One channel ban is turned (\002\00304OFF\003\002) - $status"
         }
         "ncu" {
            set second "[lindex $arguments 1]"
            switch $second {
               "on" {
                  channel set $channel +ocb-require1
                  puthelp "NOTICE $nickname :One channel ban for \002newly connected users\002 is turned (\002\00309ON\003\002)"
               }
               "off" {   
                  channel set $channel -ocb-require1
                  puthelp "NOTICE $nickname :One channel ban for \002newly connected users\002 is turned (\002\00304OFF\003\002)"
               }
               "default" {
                  if {[channel get $channel ocb-require1]} {
                     puthelp "NOTICE $nickname :One channel ban for \002newly connected users\002 is (\002\00309ON\003\002)"
                  } else {
                     puthelp "NOTICE $nickname :One channel ban for \002newly connected users\002 is (\002\00304OFF\003\002)"
                  }
               }
            }
         }
         "oc" {
            set second "[lindex $arguments 1]"
            switch $second {
               "on" {
                  channel set $channel +ocb-require2
                  puthelp "NOTICE $nickname :One channel ban for \002One channel users\002 is turned (\002\00309ON\003\002)"
               }
               "off" {   
                  channel set $channel -ocb-require2
                  puthelp "NOTICE $nickname :One channel ban for \002One channel users\002 is turned (\002\00304OFF\003\002)"
               }
               "default" {
                  if {[channel get $channel ocb-require2]} {
                     puthelp "NOTICE $nickname :One channel ban for \002One channel users\002 is (\002\00309ON\003\002)"
                  } else {
                     puthelp "NOTICE $nickname :One channel ban for \002One channel users\002 is (\002\00304OFF\003\002)"
                  }
               }
            }
         }
         "default" {
            if {[channel get $channel ocb]} {
               set status ""
               append status "(\002NCU\002) Newly connected users is "
               if {[channel get $channel ocb-require1]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }
               append status "(\002OC\002) One channel users is "
               if {[channel get $channel ocb-require2]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }

               puthelp "NOTICE $nickname :(\002OCB\002) One channel ban is (\002\00309ON\003\002) - $status"


            } else {
               set status ""
               append status "(\002NCU\002) Newly connected users is "
               if {[channel get $channel ocb-require1]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }
               append status "(\002OC\002) One channel users is "
               if {[channel get $channel ocb-require2]} { append status "(\002\00309ON\003\002) " } { append status "(\002\00304OFF\003\002) " }

               puthelp "NOTICE $nickname :(\002OCB\002) One channel ban is (\002\00304OFF\003\002) - $status"
            }
         }
      }
   }
}
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: One Channel Ban

Postby sKippah » Sun Jan 04, 2009 1:05 pm

I think we misunderstand us.

If i change
variable kickmsg1 "kickmessage for being on X channels."
with
putquick "KICK $channel $user :$::ocb::variable::kickmsg2" -next

it does not work. i wanted to take out the channel kickmessage and using just the kick message the user gets when he becomes banned. btw may u help me with the bantime?!
sKippah
 

Re: One Channel Ban

Postby Cristian » Sun Jan 04, 2009 1:26 pm

sKippah wrote:If i change
variable kickmsg1 "kickmessage for being on X channels."
with
putquick "KICK $channel $user :$::ocb::variable::kickmsg2" -next


I never wrote that you should replace the "variable kickmsg1", I wrote that you could replace the kickmessage in the script, like I did in my post before.

sKippah wrote:it does not work. i wanted to take out the channel kickmessage and using just the kick message the user gets when he becomes banned.


I have no idea what you mean, you want to take out the kickmessage, but you posted before, a kickmessage you want in... :?: :?:

sKippah wrote:btw may u help me with the bantime?!


if you read the script, you can see a variable called bantime, it is currently set to 10 for ten minutes.
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: One Channel Ban

Postby sKippah » Sun Jan 04, 2009 8:12 pm

Ahhh my fault. I didnt saw the 2nd side. OMG i am sorry.

Thanks a lot for your patience and the great script. It works fabulous.
sKippah
 

Re: One Channel Ban

Postby jonlar » Tue Jan 06, 2009 2:11 pm

Hello Sumsar ;) Could you maybe also add, if i am only connected to 2 channels i will not get banned?! Thank you ;)
jonlar
 

Re: One Channel Ban

Postby Cristian » Tue Jan 06, 2009 3:45 pm

I could make it ignore some user flags, that would be easier.

I have updated the script. http://sp00fed.org/viewtopic.php?f=13&t=209
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: One Channel Ban

Postby jonlar » Tue Jan 06, 2009 7:23 pm

Hello Sumsar. Thanks, works really good. Ehmm one last thing. Can you delete the channelmessage? that there will be only the ban message? You would help me a lot. thx
jonlar
 

PreviousNext

Return to TCL Scripting Request

Who is online

Users browsing this forum: No registered users and 4 guests

cron