| View previous topic :: View next topic |
| Author |
Message |
Fraud Op
Joined: 19 May 2008 Posts: 101
|
Posted: Sun Jan 04, 2009 8:56 am Post subject: Varable ban time |
|
|
Hello I would like to get added a Ban time so everybody gets just 2 mins banned from chan, and after that bantime the ban will be deleted. Thanks for helping
| Quote: |
setudef flag ocb
setudef flag ocb-require1
setudef flag ocb-require2
namespace eval ocb {
namespace eval variable {
variable home "#channel"
variable minchannels 2
variable trigger ".ocb"
variable signontime 600
Here maybe the variable bantime
variable kickmsg1 "kickmessage for being on X channels."
variable kickmsg2 "kickmessage for users connected to quakenet under X seconds."
}
if {[array exists hostmasks]} {
array unset hostmasks
}
array set hostmasks {
*sp00fed.dk ""
*hostname1 ""
*hostname2 ""
}
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]} {
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 "~"]
putquick "KICK $channel $user :$::ocb::variable::kickmsg1" -next
putquick "MODE $channel +b $banmask" -next
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 "~"]
putquick "KICK $channel $user :$::ocb::variable::kickmsg2" -next
putquick "MODE $channel +b $banmask" -next
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"
}
}
}
}
} |
|
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Wed Feb 04, 2009 11:24 am Post subject: |
|
|
You should be able to do this without adding/editing the script. With the DCC/telnet command chanset an set the ban-time for the channels. Example: | Code: | | .chanset #mychannel ban-time 15 | | Quote: | | Set here how long temporary bans will last (in minutes). If you set this setting to 0, the bot will never remove them. | If you need more help with a good source is http://www.eggheads.org/support/egghtml/1.6.19/mod-channels.html and .help in DCC/telnet with the bot. _________________ TCL the misunderstood |
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Thu Feb 05, 2009 7:45 am Post subject: |
|
|
I should also add, that if you wanted it to be bans made only by this script. You can add the following line | Code: | | timer 2 [list pushmode $channel -b $banmask] | after each of these lines in the script | Code: | putquick "KICK $channel $user :$::ocb::variable::kickmsg1" -next
putquick "MODE $channel +b $banmask" -next | | Code: | putquick "KICK $channel $user :$::ocb::variable::kickmsg2" -next
putquick "MODE $channel +b $banmask" -next | This would get the script to set a timer to remove the bans after 2 mins. Using the timer command. | Quote: | Usage: timer <minutes> <tcl-command>
Description: executes the given Tcl command after a certain number of minutes have passed
Returns: a timerID
Module: core |
_________________ TCL the misunderstood |
|
| Back to top |
|
 |
|