| View previous topic :: View next topic |
| Author |
Message |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Tue Jun 21, 2011 5:09 am Post subject: topic change ban |
|
|
* Inertia changes topic to 'ANUS RECTUM ANUS RECTUM ANUssss RECTUM ANUS RECTUMANUS RECTUM AHAHAHAHAHAHHA ANUS RECTUM AHAHA
A guy usually floods our channel with that kind of stuff, Because usually our channel is -t, so normal users can change topics, I need a script which has a list of words, so if a user changes a topic that includes one of those words, the guy should be banned from the channel by the eggie, thanks |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Tue Jun 21, 2011 6:23 am Post subject: |
|
|
try this script, it has couple of years... it should work...
| Code: | # Author: tomekk
# e-mail: tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)
# .chanset #channel_name +tb
# and later .save
# kick message
set kick_msg "bye bye"
# bad words (case insensitive, line-by-line)
set bad_topic_words {
*anus*
*something*
*word1*
*word2*
}
# ban type
# 1) *!*@*.domain.com
# 2) *!*@some.domain.com
# 3) *nick*!*@some.domain.com
# 4) *!*ident*@some.domain.com
set ban_type 1
######################################################
bind topc -|- "*" topc_proc
setudef flag tb
proc topc_proc { nick uhost handle chan topic } {
global bad_topic_words kick_msg botnick
if {![channel get $chan tb]} {
return
}
set kick_fag 0
foreach b_word [split $bad_topic_words "\n"] {
if {[string match -nocase [join $b_word] $topic]} {
set kick_fag 1
break
}
}
if {$kick_fag == 1} {
if {$botnick != $nick} {
putquick "MODE $chan +b [banmask $uhost $nick]"
putkick $chan $nick $kick_msg
}
}
}
proc banmask { host nick } {
global ban_type
switch -- $ban_type {
1 {
set mask "*!*@[lindex [split [maskhost $host] "@"] 1]"
}
2 {
set mask "*!*@[lindex [split $host @] 1]"
}
3 {
set mask "*$nick*!*@[lindex [split $host "@"] 1]"
}
4 {
set mask "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]"
}
return $mask
}
}
putlog "topic-ban.tcl ver 0.1 by tomekk loaded"
|
|
|
| Back to top |
|
 |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Tue Jun 21, 2011 3:21 pm Post subject: |
|
|
* gasgas changes topic to ' anus rectum'
* BallotBox sets mode: +b *!*@182.177.61.*
* gasgas was kicked by BallotBox (Trolling with the channel topic Badword in topic detected.)
<+Hawk-> good
* Retrieving #AmericaPolitics modes...
* sheperd changes topic to ' Ron Paul / Michelle Bachmann 2012 '
* Hawk- changes topic to 'Today is the anniversary of the ratification of the US Constitution on June 21, 1788'
* ezwinner changes topic to ''
* BallotBox sets mode: -b+b *!*@Cunty.users.undernet.org *!*@*.undernet.org
* WebGuy sets mode: -b *!*@*.undernet.org
* ezwinner was kicked by BallotBox (Trolling with the channel topic Badword in topic detected.)
* BallotBox sets mode: +b *!*@Cunty.users.undernet.org
The script banned ezwinner for doing nothing..... |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Tue Jun 21, 2011 4:27 pm Post subject: |
|
|
fixed...
| Code: | # Author: tomekk
# e-mail: tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)
# .chanset #channel_name +tb
# and later .save
# kick message
set kick_msg "bye bye"
# bad words (case insensitive)
set bad_topic_words {
*anus*
*something*
*word1*
*word2*
}
# ban type
# 1) *!*@*.domain.com
# 2) *!*@some.domain.com
# 3) *nick*!*@some.domain.com
# 4) *!*ident*@some.domain.com
set ban_type 1
######################################################
bind topc -|- "*" topc_proc
setudef flag tb
proc topc_proc { nick uhost handle chan topic } {
global bad_topic_words kick_msg botnick
if {![channel get $chan tb]} {
return
}
if {[string trim $topic] != "" } {
set kick_fag 0
foreach b_word [split $bad_topic_words "\n"] {
if {[string match -nocase [join $b_word] $topic]} {
set kick_fag 1
break
}
}
if {$kick_fag == 1} {
if {$botnick != $nick} {
putquick "MODE $chan +b [banmask $uhost $nick]"
putkick $chan $nick $kick_msg
}
}
}
}
proc banmask { host nick } {
global ban_type
switch -- $ban_type {
1 {
set mask "*!*@[lindex [split [maskhost $host] "@"] 1]"
}
2 {
set mask "*!*@[lindex [split $host @] 1]"
}
3 {
set mask "*$nick*!*@[lindex [split $host "@"] 1]"
}
4 {
set mask "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]"
}
return $mask
}
}
putlog "topic-ban.tcl ver 0.1 by tomekk loaded"
|
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Jun 22, 2011 2:50 am Post subject: |
|
|
you should replace
| Code: |
if {$botnick != $nick} {
|
with
| Code: |
if {[isbotnick $nick]} return
|
and move it after
| Code: |
if {![channel get $chan tb]} {
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Wed Jun 22, 2011 4:54 am Post subject: |
|
|
You're right, moving botnick check before foreach could save some IO operations when this situation occurs (but I don't think so this ever will happen...)
'global botnick' is kinda oldschool but is proper |
|
| Back to top |
|
 |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Fri Jun 24, 2011 8:48 am Post subject: |
|
|
| The script works perfect, tommek, One more little tweak to do, I want that after the bot bans the user, The bot should change the topic to some text. |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Sat Jun 25, 2011 5:20 am Post subject: |
|
|
try it:
| Code: | # Author: tomekk
# e-mail: tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)
# .chanset #channel_name +tb
# and later .save
# kick message
set kick_msg "bye bye"
# bad words (case insensitive)
set bad_topic_words {
*anus*
*something*
*word1*
*word2*
}
# topics
set topics {
"#chan1\ntopic for channel #chan1"
"#chan2\ntopic for channel #chan2"
}
# ban type
# 1) *!*@*.domain.com
# 2) *!*@some.domain.com
# 3) *nick*!*@some.domain.com
# 4) *!*ident*@some.domain.com
set ban_type 1
######################################################
bind topc -|- "*" topc_proc
setudef flag tb
proc topc_proc { nick uhost handle chan topic } {
global bad_topic_words kick_msg botnick topics
if {![channel get $chan tb]} {
return
}
if {$botnick == $nick} {
return
}
if {[string trim $topic] != "" } {
set kick_fag 0
foreach b_word [split $bad_topic_words "\n"] {
if {[string match -nocase [join $b_word] $topic]} {
set kick_fag 1
break
}
}
if {$kick_fag == 1} {
putquick "MODE $chan +b [banmask $uhost $nick]"
putkick $chan $nick $kick_msg
foreach topic $topics {
if {$topic != ""} {
set topic_data [split $topic "\n"]
set topic_chan [lindex $topic_data 0]
set topic_topic [lindex $topic_data 1]
if {$topic_chan == $chan} {
putquick "TOPIC $chan :$topic_topic"
break
}
}
}
}
}
}
proc banmask { host nick } {
global ban_type
switch -- $ban_type {
1 {
set mask "*!*@[lindex [split [maskhost $host] "@"] 1]"
}
2 {
set mask "*!*@[lindex [split $host @] 1]"
}
3 {
set mask "*$nick*!*@[lindex [split $host "@"] 1]"
}
4 {
set mask "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]"
}
return $mask
}
}
putlog "topic-ban.tcl ver 0.1 by tomekk loaded"
|
|
|
| Back to top |
|
 |
hrz Voice

Joined: 21 Jun 2011 Posts: 5 Location: Sweden
|
Posted: Sat Jun 25, 2011 7:10 am Post subject: |
|
|
I think this would be much simpler, basically:
.chanset #chan *word1*,*word2*,*some more words :D*
and
.chanset $chan This is what I want the topic to be if someone puts something nasty in my old topic
and
.chanset #chan tb-kickmsg I think you're mean for setting that topic, meanie!
and
.chanset #chan +tb
| Code: |
setudef flag tb
setudef str tb-words
setudef str tb-topic
setudef str tb-kickmsg
proc topc_proc {nick uhost handle chan topic} {
if {![channel get $chan tb] || [isbotnick $nick] || [string trim $topic] == "" } {
return
}
foreach word [split [channel get $chan tb-words] ,] {
if {[string match -nocase [join $b_word] $topic]} {set match 1}
}
if {[info exists $match]} {
set banmask [maskhost $nick!$uhost [channel get $chan ban-type]]
newchanban $chan $banmask TOPICBAN [channel get $chan tp-kickmsg] [channel get $chan ban-time]
pushmode $target_chan "+b" $banmask
flushmode $chan
putkick $chan $nick [channel get $chan tp-kickmsg]
}
}
bind topc -|- "*" topc_proc
putlog "Topic badword banner thingy hack"
|
_________________ #eggtcl on EFNet
http://code.google.com/p/hrz |
|
| Back to top |
|
 |
|