1) It sends me a message, that it was banned in that channel and also the text to the homechan, of the ban was okey ( wrong IP again of course on both items).
This script uses newban system, try reading about it in TCL-commands.doc - You'll learn what it does.2) the ban was not send at all to the channel, as the bot blocked it, that it couldn't ban itself.. ( maybe that was the reason for only 1 time.. dunno )
As I said, READ the tcl-commands.doc - then you'll understand how newban works.3) also didn't kick from all channels..
umm, you never asked for an !unban command. You only asked for EXACTLY what I gave you.3) An !unban command would be very helpful.
Ok, sure. This is what I came up with, but for some reason it was still wrong :/SpiKe^^ wrote:Do you want to add this ban to the bot's internal ban list too? I'm thinking yes, so it can be made permanent.
Do you still have the slightly briken script Get_A_Fix poated to this string?
If so, please post it back to this string, and maybe we can just fix its' issues:)
Code: Select all
# AddBan TCL - istok@IRCSpeed.org
# $Id: addban.tcl,v1 27/12/2012 05:00:42am GMT +12 (NZST) istok Exp $
# Command: !kb nickname <reasons here>
# Set your default trigger here.
set trigga "!"
# Set your home/report channel.
set homechan "#whatever"
# Set Default kick reason here.
set kreason "You have been removed from the channel due to breach of Conduct."
# Set Default ban time for user. (in minutes)
set btime "60"
# BAN Types are given below;
# 1 - *!*@some.domain.com
# 2 - *!*@*.domain.com
# 3 - *!*ident@some.domain.com
# 4 - *!*ident@*.domain.com
# 5 - *!*ident*@some.domain.com
# 6 - *nick*!*@*.domain.com
# 7 - *nick*!*@some.domain.com
# 8 - nick!ident@some.domain.com
# 9 - nick!ident@*.host.com
set bantype 1
## ----------- No Need to Edit Below Here!! ------------- ##
bind pub - ${trigga}kb kickban
proc makeTrig {} {
global trig
return $trig
}
proc kickban {nick uhost hand chan arg} {
global homechan kreason btime
if {![matchattr [nick2hand $nick] o|o $chan] && ![botisop $chan]} {return}
set target [lindex [split $arg] 0]
if {$target == ""} {putquick "NOTICE $nick :\002ERROR\002: Incorrect Parameters. \002SYNTAX\002: [makeTrig]kb nickname <reasons here>"; return}
set banmask [make:banmask $uhost $target]
set reasons [join [lrange [split $arg] 1 end]]
if {$reasons == ""} {putquick "NOTICE $nick :Adding New Ban for $target"; newban $banmask $nick "$kreason" $btime; puthelp "PRIVMSG $homechan :\002NewBan\002: $nick ($uhost) just added a ban to $target ($banmask) for [channels]"; putquick "KICK $chan $target :$kreason"; return}
putquick "NOTICE $nick :Adding New Ban for $target"; putquick "KICK $chan $target :$reasons"
newban $banmask $nick "$reasons" $btime
puthelp "PRIVMSG $homechan :\002NewBan\002: $nick ($uhost) just added a ban to $target ($banmask) for [channels]"
}
proc make:banmask {uhost nick} {
global bantype
switch -- $bantype {
1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}
putlog "ADDBAN Loaded!"
Code: Select all
# GlobalKickBan.tcl Version 1.0 by SpiKe^^ (7 Jan 2013) #
# author: SpiKe^^ #
# e-mail: spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #
# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #
# This script will kick & ban the given nick from all channels the bot
# is on, except for those channels set as exempt from this script.
# Can report all kick/ban information to any nick and/or channel.
# Can set server only bans, or add bans to the bot's internal banlist.
# Can use default reason or the reason provided with the !kb command.
# Can set bans in 11 formats, with checks for hosts like *.undernet.org
# Can set exempt flags & masks for users that can't be targeted by !kb
# Complete online help for all available !kb command options.
####################################################################
# Global Kick & Ban Command Info #
# syntax: !kb <nick> [+t<time>] [+b<banmask#>] [reason] #
# :or: !kb <nick> [+t<time>] [+alt] [reason] #
# #
# time: Optional (if not specified, defaults to below setting) #
# If time is specified: #
# -1 = just set a sever ban (don't add to bot's ban list) #
# 0 = permanent ban in the bot's internal ban list. #
# Any number greater than 0 is the ban expiration in minutes. #
# To make the time in hours, append the time with 'h' (+t12h) #
# To make the time in days, append the time with 'd' (+t7d) #
# If not a server ban, reason will be used in bot's ban list. #
# To make the ban sticky, append the time with a '!' #
# Examples: #
# !kb bart +t-1 (set server bans for bart on all channels) #
# !kb ted +t90 (set a 90 min global ban in bot's ban list) #
# !kb enor +t0! (set a permanent global sticky ban for enor) #
# !kb sam +t7d! (set a 7 day global sticky ban for sam) #
# #
# banmask#: Optional (if not specified, defaults to below setting) #
# If specified as: +alt :uses the alt banmask setting below. #
# List of all available banmask#'s for commands and settings #
# -1 : nick!*@* #
# 0 : *!user@host.domain #
# 1 : *!*user@host.domain #
# 2 : *!*@host.domain #
# 3 : *!*user@*.domain #
# 4 : *!*@*.domain #
# 5 : nick!user@host.domain #
# 6 : nick!*user@host.domain #
# 7 : *nick*!*@host.domain #
# 8 : nick!*user@*.domain #
# 9 : *nick*!*@*.domain #
# Examples: #
# !kb bart +b5 (set a ban on bart using ban mask number 5) #
# !kb ted +b-1 (set a nick ban on ted like: ted!*@*) #
# !kb sam +alt (set the ban using alternate banmask setting) #
# #
# reason: Optional (if not specified, defaults to below settings) #
# If reason is specified: it will be used for the kick reason, #
# and/or for the reason the ban was added to the bot's ban list. #
####################################################################
# Some Eggdrop Settings That Will Affect How This Script Works:
# - Just set a sever ban :: may require chanset +userbans
# for this bot and other bots, for all gKB channels.
# - Chanset +enforcebans could cause not showing set kick reason.
# - Chanset ban-time will cause this bot and others to remove
# server only bans after the time set for that chanset.
# - Config file setting #### CHANNELS MODULE #### set force-expire
# may cause other bots on the channels to expire this bot's bans.
# - May also be issues with chanserv bot, add bot as trusted.
##################### Begin Settings #####################
# set the public trigger for the global kick/ban command #
# or set this empty to disable the public command #
set gKB(pcmd) "!kb"
# access flags requied to use the global kick/ban command #
set gKB(flag) "mno|mn"
# exempt flags: nicks with these flags can't be targeted by this script #
set gKB(xflag) "bmno|mn"
# exempt masks: space seperated list of exempt nicks and/or hosts #
# nicks matching any of these nick/host masks can't be targeted by gKB #
# add nicks like: nick!* (a nick followed by !*)
# add hosts like: *@host (*@ followed by a host)
# add user@host like: *!cservice@undernet.org
# example: set gKB(xhost) {*!cservice@undernet.org spike^^!*}
set gKB(xhost) {*!cservice@undernet.org}
# exempt channels: list of channels not affected by this script #
# example: set gKB(xchan) {#channel #chan2 #chan3}
set gKB(xchan) {}
# set the report channel(s)/nick(s) for the kick/ban info #
# use to track who bans who (list any number of nicks and/or chans) #
# example: set gKB(reprt) {#adminchan admin_nick}
# or set this empty to not report !kb info to any chan or nick #
set gKB(reprt) {}
# set the default reason for the kick (if none provided) #
set gKB(krsn) "We are done with you!"
# set the default reason for the ban (if none provided) #
set gKB(brsn) "We are done with you!"
# set default ban time/method for setting bans (if none provided) #
# -1 = just set a sever ban (don't add to bot's ban list) #
# 0 = permanent ban in the bot's internal ban list. #
# any number greater than 0 is the internal ban expiration in minutes. #
set gKB(btime) "360" ;# 360 = 6 hours #
# if a ban is being set using above default time, should it also be set sticky #
set gKB(bstik) "0" ;# 1 = yes, set ban sticky # 0 = no, don't set sticky #
# set default banmask to use for banning (if no +b<banmask#> or +alt provided) #
# use numbers from the above "List of all available banmask#'s" #
set gKB(btype) "3"
# set alternate banmask to use for banning (if option +alt is used with !kb) #
# use numbers from the above "List of all available banmask#'s" #
set gKB(atype) "4"
# gKB server bans: should gKB also set them on chans the ban nick isn't on ?? #
# 1 = yes, do server bans on all gKB chans, even if ban nick isn't there #
# 0 = no, only do server bans on the gKB chans that banned nick is on #
set gKB(aserv) "1"
# Set host(s) that should never be masked !! #
# example: the hidden host name for undernet (ex. Starr.users.undernet.org) #
# under many masking routines, this becomes: *.undernet.org
# a ban mask like that risks banning everyone with a registered username!
# any host name matching a mask in this setting will never be masked with *
# some examples of what you might add here:
# for undernet add: *.users.undernet.org
# for quakenet add: *.users.quakenet.org
# note: you can add more than 1 mask here, in a space separated list #
set gKB(nomsk) "*.users.undernet.org"
##########################################################
###################### End Settings ######################
##########################################################
proc gkb:unbind {} {
foreach bnd [binds gkb:unbind] {
foreach {ty fl na hi pr} $bnd { break }
unbind $ty $fl $na $pr
}
}
gkb:unbind
proc gkb:remsp {st} {
return [string trim [regsub -all -- {\s{2,}} $st { }]]
}
foreach gkbset {pcmd flag xflag krsn brsn btime bstik btype atype aserv} {
set gKB($gkbset) [string trim $gKB($gkbset)]
}
set gKB(reprt) [split [gkb:remsp $gKB(reprt)]]
set gKB(xhost) [split [string tolower [gkb:remsp $gKB(xhost)]]]
set gKB(xchan) [split [string tolower [gkb:remsp $gKB(xchan)]]]
set gKB(nomsk) [split [string tolower [gkb:remsp $gKB(nomsk)]]]
proc gkb:bind {} {
bind pub $::gKB(flag) $::gKB(pcmd) gkb:kickban
}
if {$gKB(pcmd) ne ""} { gkb:bind }
proc gkb:kickban {nk uh hn ch tx} { set tls [split [set tx [gkb:remsp $tx]]]
if {[llength $tls]=="0"} { set help 1
} else { set bnk [lindex $tls 0]
if {[string match {+[ba]*} $bnk] || $bnk eq "-banmask"} { set help 3
} elseif {[string match +t* $bnk] || $bnk eq "-time"} { set help 2 }
}
if {[info exists help]} { set cm $::gKB(pcmd) ; set x "Help"
if {$::gKB(btime)=="-1"} { set bt "server ban"
} else { set bt "$::gKB(btime) min" }
if {$help=="2"} { set x "\002(time options help)" }
if {$help=="3"} { set x "\002(banmask options help)" }
puthelp "PRIVMSG $nk :\002Global Kick & Ban Command $x"
puthelp "PRIVMSG $nk :syntax: $cm <nick> \[+t<time>\] \[+b<banmask#>\] \[reason\]"
puthelp "PRIVMSG $nk : :or: $cm <nick> \[+t<time>\] \[+alt\] \[reason\]"
set cm
if {$help<"3"} {
puthelp "PRIVMSG $nk :time: Optional (if not specified, defaults to $bt)"
puthelp "PRIVMSG $nk : -1 = just set a sever ban (don't add to bots ban list)"
puthelp "PRIVMSG $nk : 0 = permanent ban in the bot's internal ban list."
puthelp "PRIVMSG $nk : Any number greater than 0 is the ban time in minutes."
}
if {$help=="1"} {
puthelp "PRIVMSG $nk : Example:"
puthelp "PRIVMSG $nk : \002$cm sam +t90\002 (set 90 min ban in bot's ban list)"
puthelp "PRIVMSG $nk : Use \002$cm +t\002 to see more time options & examples."
}
if {$help=="2"} {
puthelp "PRIVMSG $nk : To make the time in hours, append the time with 'h'."
puthelp "PRIVMSG $nk : To make the time in days, append the time with 'd'."
puthelp "PRIVMSG $nk : To make the ban sticky, append the time with a '!'."
puthelp "PRIVMSG $nk : Examples:"
puthelp "PRIVMSG $nk : \002$cm bart +t-1\002 (set server bans for bart)"
puthelp "PRIVMSG $nk : \002$cm sam +t90\002 (set 90 min ban in bot's ban list)"
puthelp "PRIVMSG $nk : \002$cm enor +t0!\002 (set permanent global sticky ban)"
puthelp "PRIVMSG $nk : \002$cm sam +t7d!\002 (set a 7 day global sticky ban)"
puthelp "PRIVMSG $nk : Use \002$cm\002 to see the main global kick/ban help."
return
}
set bm $::gKB(btype) ; set am $::gKB(atype)
puthelp "PRIVMSG $nk :banmask#: Optional (if not specified, defaults to $bm)"
puthelp "PRIVMSG $nk : If specified as: +alt :uses the alt banmask# $am."
if {$help=="1"} {
set tm1 [string trim [gkb:setmask bart user@host.domain.c $bm] .c]
set tm2 [string trim [gkb:setmask sam user@host.domain.c $am] .c]
puthelp "PRIVMSG $nk : Examples:"
puthelp "PRIVMSG $nk : \002$cm bart\002 (mask like: $tm1)"
puthelp "PRIVMSG $nk : \002$cm sam +alt\002 (mask like: $tm2)"
puthelp "PRIVMSG $nk : Use \002$cm +b\002 to see all banmask options & examples."
puthelp "PRIVMSG $nk :reason: Optional (if not specified, uses the defaults)"
puthelp "PRIVMSG $nk : If specified: it will be used for the kick reason,"
puthelp "PRIVMSG $nk : and/or for the reason the ban was added to the bot."
puthelp "PRIVMSG $nk : Def kick reason: $::gKB(krsn)"
puthelp "PRIVMSG $nk : Def ban reason: $::gKB(brsn)"
return
}
puthelp "PRIVMSG $nk : List of all available banmask#'s for +b"
puthelp "PRIVMSG $nk : -1 : nick!*@*"
puthelp "PRIVMSG $nk : 0 : *!user@host.domain"
puthelp "PRIVMSG $nk : 1 : *!*user@host.domain"
puthelp "PRIVMSG $nk : 2 : *!*@host.domain"
puthelp "PRIVMSG $nk : 3 : *!*user@*.domain"
puthelp "PRIVMSG $nk : 4 : *!*@*.domain"
puthelp "PRIVMSG $nk : 5 : nick!user@host.domain"
puthelp "PRIVMSG $nk : 6 : nick!*user@host.domain"
puthelp "PRIVMSG $nk : 7 : *nick*!*@host.domain"
puthelp "PRIVMSG $nk : 8 : nick!*user@*.domain"
puthelp "PRIVMSG $nk : 9 : *nick*!*@*.domain"
puthelp "PRIVMSG $nk : Examples:"
puthelp "PRIVMSG $nk : \002$cm bart +b5\002 (set ban on bart using banmask# 5)"
puthelp "PRIVMSG $nk : \002$cm ted +b-1\002 (set nick ban on ted like: ted!*@*)"
puthelp "PRIVMSG $nk : \002$cm sam +alt\002 (set ban using alt banmask# $am)"
puthelp "PRIVMSG $nk : Use \002$cm\002 to see the main global kick/ban help."
return
}
set buh [getchanhost $bnk]
if {$buh eq ""} { set pre "gKB> $bnk is not a valid nick. Use"
puthelp "NOTICE $nk :$pre \002$::gKB(pcmd)\002 for Kick/Ban help."
return
}
set xmpt 0 ; set rls $::gKB(reprt)
if {[isbotnick $bnk]} { set xmpt 1
} elseif {$::gKB(xflag) ne ""} { set han [nick2hand $bnk]
if {$han ne "" && $han ne "*"} { set bhn $han
if {[matchattr $bhn $::gKB(xflag) $ch]} { set xmpt 2 }
}
}
if {$xmpt=="0"} {
foreach msk $::gKB(xhost) {
if {[string match -nocase $msk $bnk!$buh]} { set xmpt 2 ; break }
}
}
if {$xmpt>"0"} {
if {$xmpt=="1"} { set x Me
puthelp "NOTICE $nk :gKB> You Can't Kick/Ban Me!"
} else { puthelp "NOTICE $nk :gKB> You Can't Kick/Ban $bnk!" ; set x $bnk }
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> $nk tried to Kick/Ban $x in $ch!"
}
return
}
if {[llength $tls]>"1"} { set idx 0
foreach item [lrange $tls 1 2] {
if {[string match +t* $item]} { set item [string range $item 2 end]
set btime "" ; set bstik 0 ; incr idx
if {[string match *! $item]} { set bstik 1
set item [string trimright $item !]
}
if {$item eq ""} { continue }
if {$item eq "-1"} { set btime "-1" ; continue }
if {$item=="0"} { set btime 0 ; continue }
set btime 0
while {[string length $item]>"0"} { set x [string index $item end]
if {$x eq "m" || [string is digit $x]} {
set item [string trimright $item m]
foreach {str num} [gkb:getmun $item] { break }
if {$num ne ""} { set btime [expr {$num+$btime}] }
set item $str
} elseif {$x eq "d"} { set item [string trimright $item d]
foreach {str num} [gkb:getmun $item] { break }
if {$num ne ""} { set btime [expr {($num*1440)+$btime}] }
set item $str
} elseif {$x eq "h"} { set item [string trimright $item h]
foreach {str num} [gkb:getmun $item] { break }
if {$num ne ""} { set btime [expr {($num*60)+$btime}] }
set item $str
} else { break }
}
if {$btime=="0"} { set btime "" }
} elseif {[string match +b* $item]} { incr idx
set item [string range $item 2 end]
if {$item eq ""} { continue }
if {$item eq "-1"} { set bmnum "-1" ; continue }
if {[string length [set x [gkb:fixnum $item]]]=="1"} { set bmnum $x }
} elseif {[string match +a* $item]} { incr idx ; set bmnum $::gKB(atype)
} else { break }
}
set tls [lreplace $tls 0 $idx]
} else { set tls [list] }
if {[llength $tls]>"0"} { set bresn [join $tls] ; set kresn [join $tls]
} else { set bresn $::gKB(brsn) ; set kresn $::gKB(krsn) }
if {![info exists btime] || $btime==""} { set btime $::gKB(btime) }
if {![info exists bstik]} { set bstik $::gKB(bstik) }
if {![info exists bmnum]} { set bmnum $::gKB(btype) }
set bmask [gkb:setmask $bnk $buh $bmnum] ; set cls ""
foreach chan [channels] {
if {[lsearch -exact $::gKB(xchan) [string tolower $chan]]>"-1"} { continue }
lappend cls $chan
}
if {$cls eq ""} { puthelp "NOTICE $nk :gKB> Error: No valid gKB channels!"
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> Error to $nk: No valid gKB channels!"
}
return
}
if {$btime=="-1"} { set bls "" ; set erls ""
foreach chan $cls {
if {[botisop $chan]} {
if {[onchan $bnk $chan] || $::gKB(aserv)=="1"} { lappend bls $chan
putquick "MODE $chan +b $bmask"
if {[onchan $bnk $chan]} { putquick "KICK $chan $bnk :$kresn" }
}
} elseif {[onchan $bnk $chan] || $::gKB(aserv)=="1"} { lappend erls $chan }
}
if {$bls eq "" && $erls eq ""} {
puthelp "NOTICE $nk :gKB> Error: $bnk isn't on any gKB channels!"
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> Error to $nk: $bnk isn't on any gKB channels!"
}
return
}
if {$bls ne ""} { set x ban
if {[llength $bls]>"1"} { set x bans }
set y [gkb:jnlist $bls]
puthelp "NOTICE $nk :gKB> Set server $x for $bnk ($bmask) on $y"
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> $nk set server $x for $bnk ($bmask) on $y"
}
}
if {$erls ne ""} { set x ban ; set z "Bot Not Ops Error"
if {[llength $erls]>"1"} { set x bans }
set y [gkb:jnlist $erls]
puthelp "NOTICE $nk :gKB> ${z}: Couldn't set server $x on $y"
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> $z to $nk: Couldn't set server $x on $y"
}
}
return
}
set bset 0 ; set erls ""
if {$bstik=="0"} { set bstik none } else { set bstik sticky }
if {[llength $::gKB(xchan)]=="0"} { set bset 1
newban $bmask $nk $bresn $btime $bstik
}
foreach chan $cls {
if {$bset=="0"} { newchanban $chan $bmask $nk $bresn $btime $bstik }
if {[botisop $chan]} {
if {[onchan $bnk $chan]} { putquick "KICK $chan $bnk :$kresn" }
} else { lappend erls $chan }
}
set time permanent ; if {$btime>"0"} { set time "$btime minute" }
if {$bstik eq "sticky"} { append time " sticky" }
if {$bset=="1"} { set x "a $time global ban for $bnk ($bmask)"
puthelp "NOTICE $nk :gKB> Set $x in the bot's banlist."
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> $nk set $x in the bot's banlist."
}
} else { set y [gkb:jnlist $cls]
set z "" ; if {[llength $cls]>"1"} { set z s }
set x "$time channel ban$z for $bnk ($bmask)"
puthelp "NOTICE $nk :gKB> Set $x in the bot's $y banlist$z."
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> $nk set $x in the bot's $y banlist$z."
}
}
if {$erls ne ""} { set z "Bot Not Ops Error" ; set y [gkb:jnlist $erls]
puthelp "NOTICE $nk :gKB> ${z}: Unable to ban or kick on $y"
foreach rc $rls {
puthelp "PRIVMSG $rc :gKB> $z to $nk: Unable to ban or kick on $y"
}
}
return
}
proc gkb:jnlist {ls} {
if {[llength $ls]<"2"} { return [join $ls] }
return "[join [lrange $ls 0 end-1] ", "] & [lindex $ls end]"
}
proc gkb:getmun {str} { set num ""
while {[string length $str]>"0"} {
if {[string is digit -strict [set char [string index $str end]]]} {
set num $char$num ; set str [string replace $str end end]
} else { break }
}
return [list $str [gkb:fixnum $num]]
}
proc gkb:fixnum {num} {
if {![string is digit -strict $num]} { return "" }
set num [string trimleft $num 0]
if {$num eq ""} { set num 0 } ; return $num
}
proc gkb:setmask {nk uh bt} {
foreach {un hs} [split $uh @] { break }
foreach {x mu mh} [split [maskhost $nk!$uh] !@] { break }
foreach nom $::gKB(nomsk) {
if {[string match -nocase $nom $hs]} { set mh $hs ; break }
}
switch -- $bt {
-1 { set mask $nk!*@* }
0 { set mask *!$uh }
1 { set mask *!$mu@$hs }
2 { set mask *!*@$hs }
4 { set mask *!*@$mh }
5 { set mask $nk!$uh }
6 { set mask $nk!$mu@$hs }
7 { set mask *$nk*!*@$hs }
8 { set mask $nk!$mu@$mh }
9 { set mask *$nk*!*@$mh }
default { set mask *!$mu@$mh }
}
return $mask
}
putlog "GlobalKickBan.tcl Ver. 1.0 by SpiKe^^ Loaded."