diff --git a/textflood.tcl b/textflood.tcl new file mode 100644 index 0000000..abfa429 --- /dev/null +++ b/textflood.tcl @@ -0,0 +1,78 @@ +# $Id: textflood.tcl,v1.6 09/03/2015 12:37:19am GMT +12 (NZST) IRCSpeed Exp $ +# SYNTAX (on PartyLine/DCC/CTCP/TELnet): +# .chanset #channel flood-chan lines:seconds +# example: .chanset #IRCSpeed flood-chan 5:2 (5lines:2seconds) + +## Set the Lock Modes +# Bot will change channel mode to the modes you will specify below in case the bot will detect text flood +# To Disable Mode change set it to "" +set textlockmodes "mR" + +## Set the time in seconds to Unlock Modes (needed even if textlockmodes are "") +# The Bot will Unlock the channel after the specified time you will set below +set unlocktime "15" + +## Set the time in minutes to Unban (needed even if textlockmodes are "") +# The Bot will Unban the user after the specified time you will set below +set unbantime "60" + +## Set Kick Reason +# Default kick reason is already set, using control codes to make bold/underline text. +# Remove the \002 and \037 tags if you wish to remove control codes. +set kickmsg "\037T\037\002ext\002 \037F\037\002lood\002 \037D\037\002etected\002" + +# Set global exempt flags (default: ovf) +set floodglobflags ovf + +# Set channel exempt flags (default: ovf) +set floodchanflags ovf + +# 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 + +########################### +# CONFIGURATION ENDS HERE # +########################### + +bind flud - pub textflood +proc textflood {nick uhost hand type chan} { + global textlockmodes unbantime unlocktime kickmsg + global floodglobflags floodchanflags + if {![botisop $chan] && [matchattr [nick2hand $nick] $floodglobflags|$floodchanflags $chan]} {return} + if {![isop $nick $chan] && ![isvoice $nick $chan]} { + set banmask [make:banmask $uhost $nick] + putquick "MODE $chan +b$textlockmodes $banmask" + putquick "KICK $chan $nick :$kickmsg" + utimer $unlocktime [list putquick "MODE $chan -$textlockmodes"] + timer $unbantime [list putquick "MODE $chan -b $banmask"] + } + return +} + +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 "Loaded: textflood.tcl - istok @ IRCSpeed" diff --git a/whois.tcl b/whois.tcl new file mode 100644 index 0000000..eb77a7b --- /dev/null +++ b/whois.tcl @@ -0,0 +1,236 @@ +# $Id: whois.tcl,v1.3a 04/02/2015 06:23:31am GMT +12 (NZST) IRCSpeed Exp $ + +## Commands +# ---------- +# !whoami - shows your own personal status info. +# !whois - shows personal status info for . +# /msg yourbot whois #channel + +# Set your global command trigger here (default set to ! <-) +set whoispubtrig "!" + +# ----- NO EDITING ----- +proc getWhoTrigger {} { + global whoispubtrig + return $whoispubtrig +} + +bind pub - ${whoispubtrig}whoami whoami:pub +proc whoami:pub {nick uhost hand chan arg} { + if {![validuser [nick2hand $nick]]} {putquick "NOTICE $nick :\037ERROR\037: You are NOT known to me."; return} + + if {![regexp c [getchanmode $chan]]} { + putquick "PRIVMSG $chan :\002Nick\002: $nick ($uhost) - \002Handle\002: [nick2hand $nick] - \002Flags\002: [chattr [nick2hand $nick] $chan]" + + if {[matchattr [nick2hand $nick] n]} { + putquick "PRIVMSG $chan :You are an \002Administrator\002 for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $nick] m]} { + putquick "PRIVMSG $chan :You are a \002Co Administrator\002 for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $nick] o]} { + putquick "PRIVMSG $chan :You are a \002Global Operator\002 for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $nick] |n $chan]} { + putquick "PRIVMSG $chan :You are a \002Channel Owner\002 for $chan" + return 0 + } + + if {[matchattr [nick2hand $nick] |m $chan]} { + putquick "PRIVMSG $chan :You are a \002Channel Master\002 for $chan" + return 0 + } + + if {[matchattr [nick2hand $nick] |o $chan]} { + putquick "PRIVMSG $chan :You are a \002Channel Operator\002 for $chan" + return 0 + } + + if {[matchattr [nick2hand $nick] |v $chan]} { + putquick "PRIVMSG $chan :You are a \002Channel Voice\002 for $chan" + return 0 + } + } + + if {[regexp c [getchanmode $chan]]} { + putquick "PRIVMSG $chan :Nick: $nick ($uhost) - Handle: [nick2hand $nick] - Flags: [chattr [nick2hand $nick] $chan]" + + if {[matchattr [nick2hand $nick] n]} { + putquick "PRIVMSG $chan :You are an Administrator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $nick] m]} { + putquick "PRIVMSG $chan :You are a Co Administrator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $nick] o]} { + putquick "PRIVMSG $chan :You are a Global Operator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $nick] |n $chan]} { + putquick "PRIVMSG $chan :You are a Channel Owner for $chan" + return 0 + } + + if {[matchattr [nick2hand $nick] |m $chan]} { + putquick "PRIVMSG $chan :You are a Channel Master for $chan" + return 0 + } + + if {[matchattr [nick2hand $nick] |o $chan]} { + putquick "PRIVMSG $chan :You are a Channel Operator for $chan" + return 0 + } + + if {[matchattr [nick2hand $nick] |v $chan]} { + putquick "PRIVMSG $chan :You are a Channel Voice for $chan" + return 0 + } + } +} + +bind pub - ${whoispubtrig}whois whois:pub +proc whois:pub {nick uhost hand chan arg} { + if {![matchattr [nick2hand $nick] o|ovf $chan]} {putquick "NOTICE $nick :ERROR: You do not have access to this command."; return} + set whoisnick [lindex [split $arg] 0] + if {($whoisnick == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getWhoTrigger]whois nickname"; return} + if {($whoisnick == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getWhoTrigger]whois nickname"; return} + if {![validuser [nick2hand $whoisnick]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $whoisnick is an Unknown User."; return} + if {![validuser [nick2hand $whoisnick]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $whoisnick is an Unknown User."; return} + if {![regexp c [getchanmode $chan]]} { + putquick "PRIVMSG $chan :\002Nick\002: $whoisnick ([getchanhost $whoisnick $chan]) - \002Handle\002: [nick2hand $whoisnick] - \002Flags\002: [chattr [nick2hand $whoisnick] $chan]" + + if {[matchattr [nick2hand $whoisnick] n]} { + putquick "PRIVMSG $chan :$whoisnick is an \002Administrator\002 for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] m]} { + putquick "PRIVMSG $chan :$whoisnick is a \002Co Administrator\002 for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] o]} { + putquick "PRIVMSG $chan :$whoisnick is a \002Global Operator\002 for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |n $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a \002Channel Owner\002 for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |m $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a \002Channel Master\002 for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |o $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a \002Channel Operator\002 for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |v $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a \002Channel Voice\002 for $chan" + return 0 + } + } + + if {[regexp c [getchanmode $chan]]} { + putquick "PRIVMSG $chan :Nick: $whoisnick ([getchanhost $whoisnick $chan]) - Handle: [nick2hand $whoisnick] - Flags: [chattr [nick2hand $whoisnick] $chan]" + + if {[matchattr [nick2hand $whoisnick] n]} { + putquick "PRIVMSG $chan :$whoisnick is an Administrator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] m]} { + putquick "PRIVMSG $chan :$whoisnick is a Co Administrator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] o]} { + putquick "PRIVMSG $chan :$whoisnick is a Global Operator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |n $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a Channel Owner for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |m $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a Channel Master for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |o $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a Channel Operator for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |v $chan]} { + putquick "PRIVMSG $chan :$whoisnick is a Channel Voice for $chan" + return 0 + } + } +} + +bind msg - whois whois:msg +proc whois:msg {nick uhost hand arg} { + global botnick + if {![string match "*#*" $arg]} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick whois #channel nickname"; return} + set chan [lindex [split $arg] 0] + if {![matchattr [hand2nick $hand] o|m $chan]} {putquick "NOTICE $nick :\037ERROR\037: You do not have access to this command."; return} + if {$chan == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick whois #channel nickname"; return} + set whoisnick [lindex [split $arg] 1] + if {$whoisnick == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick whois $chan nickname"; return} + if {![validuser [nick2hand $whoisnick]]} {putquick "NOTICE $nick :$whoisnick is an Unknown User."; return} + putquick "NOTICE $nick :\002Nick\002: $whoisnick ([getchanhost $whoisnick $chan]) - \002Handle\002: [nick2hand $whoisnick] - \002Flags\002: [chattr [nick2hand $whoisnick] $chan]" + + if {[matchattr [nick2hand $whoisnick] n]} { + putquick "NOTICE $nick :$whoisnick is an Administrator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] m]} { + putquick "NOTICE $nick :$whoisnick is a Co Administrator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] o]} { + putquick "NOTICE $nick :$whoisnick is a Global Operator for my Bot Group" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |n $chan]} { + putquick "NOTICE $nick :$whoisnick is a Channel Owner for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |m $chan]} { + putquick "NOTICE $nick :$whoisnick is a Channel Master for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |o $chan]} { + putquick "NOTICE $nick :$whoisnick is a Channel Operator for $chan" + return 0 + } + + if {[matchattr [nick2hand $whoisnick] |v $chan]} { + putquick "NOTICE $nick :$whoisnick is a Channel Voice for $chan" + return 0 + } +} + +putlog ".:LOADED:. whois.tcl,v1.3a - istok @ IRCSpeed"