| View previous topic :: View next topic |
| Author |
Message |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Fri Dec 30, 2005 11:33 pm Post subject: modification |
|
|
Please how to replace the dcc by cmd on the chan
expl: !badwords or $badwords the bot say notice
bot notice lists global badwords etc etc ( all cmd)
And instead of kick or kickban -------> 1 bad word to inform (warning!!!) repeat bad word kick et 3 repeat banned 2 mns
thx for help
| Code: | #badwords.tcl
#by Elven <elven@elven.de>
# LEGAL DISCLAIMER:
# THIS SCRIPT IS UNDER THE GPL LICENCE.
# For more information see the accompanying gpl.txt
####################
# Quick Start:
# .badwords - lists global badwords
# .badwords #channel - lists channel badwords
# .badwords all - lists all badwords
# .+badword <regexp> - adds global badword
# .+badword #channel <rx> - adds channel badword
# .-badword <id> - removes global badword (see .badwords for id)
# .-badword #channel <id> - go figure
#
# .chanset #channel +badwords - enable badword protection for this channel
####################
# configuration
set badword(cflag) "m|m"
#what flags are needed to edit badwords? (global|channel)
set badword(flag) "of|of"
#users not affected by badword scan
set badword(reaction) 1
# 0 - kick
# 1 - kickban
set badword(banmsg) {
"Badword."
}
#reason/comment on ban
set badword(bantime) 10
#ban time in minutes
set badword(savefile) "$datapath/badwords"
#file format:
# =channelname/-globals
# ~badword
# ~badword
# =anotherchannel
# ~badword
# ...
set badword(quietsave) 1
#dont log 'Saved on automatic save.'
####################
# code below
setudef flag badwords
bind dcc "-" "+badword" badword:add
bind dcc "-" "-badword" badword:del
bind dcc "-" "badwords" badword:list
bind dcc "-" "badword" badword:list
bind evnt "-" "save" badword:save
bind evnt "-" "loaded" badword:load
bind pubm "-" "*" badword:msg
proc badword:add {h i t} {
global badword badwords
set lst [split $t]
set chn [join [lindex $lst 0]]
set chn [string tolower $chn]
if {[llength $lst] == 0} {
putidx $i "\002Syntax:\002 +badword \[#channel\] <regexp string>"
putidx $i " Adds a channel or (if channel is ommited) global badword."
return 0
}
if {[regexp {^#.+$} $chn]} {
if {![matchattr $h $badword(cflag) $chn]} {
putidx $i "Only channel masters and above can add channel badwords."
return 1
}
set bword [join [lrange $lst 1 end]]
if {[string trim $bword] == ""} { putidx $i "Please specify a badword to add." ; return 0 }
if {![info exists badwords($chn)]} {
set badwords($chn) [list $bword]
} {
lappend badwords($chn) $bword
}
putidx $i "Added $bword as $chn channel badword."
} {
if {![matchattr $h $badword(cflag)]} {
putidx $i "Only global masters and above can add global badwords."
return 1
}
set bword [join $lst]
if {[string trim $lst] == ""} { putidx $i "Please specify a badword to add." ; return 0 }
set chn "-global"
lappend badwords($chn) $bword
putidx $i "Added $bword as global badword."
}
return 1
}
proc badword:del {h i t} {
global badword badwords
set lst [split $t]
set chn [join [lindex $lst 0]]
set chn [string tolower $chn]
if {[llength $lst] == 0} {
putidx $i "\002Syntax:\002 -badword \[#channel\] <number>"
putidx $i " Removes a channel or (if channel is ommited) global badword. Number specifies the item in .badwords"
return 0
}
if {[regexp {^#.+$} $chn]} {
if {![matchattr $h $badword(cflag) $chn]} {
putidx $i "Only channel masters and above can delete channel badwords."
return 1
}
set id [join [lindex $lst 1]]
} {
if {![matchattr $h $badword(cflag)]} {
putidx $i "Only global masters and above can delete global badwords."
return 1
}
set id [join [lindex $lst 0]]
set chn "-global"
}
set bwo [lindex $badwords($chn) $id]
if {$bwo == ""} {
putidx $i "Invalid ID."
return 1
}
set badwords($chn) [lreplace $badwords($chn) $id $id]
if {$chn=="-global"} {
putidx $i "Removed global badword $bwo."
} {
putidx $i "Removed channel badword $bwo on $chn."
}
return 1
}
proc badword:list {h i t} {
global badword badwords
set lst [split $t]
set chn [join [lindex $lst 0]]
set chn [string tolower $chn]
if {$chn == ""} {
if {![matchattr $h $badword(cflag)]} {
putidx $i "Only global masters and above can list global badwords."
return 1
}
if {[info exists badwords(-global)]} {
if {[llength $badwords(-global)]==0} {
putidx $i "No global badwords."
} {
putidx $i "Global badwords:"
set l 0
foreach x $badwords(-global) {
putidx $i "$l: $x"
incr l
}
putidx $i "End of list."
}
} {
putidx $i "No global badwords."
}
return 1
} elseif {$chn == "all"} {
if {![matchattr $h $badword(cflag)]} {
putidx $i "Only global masters and above can list all badwords."
return 1
}
foreach x [array names badwords] {
if {[llength $badwords($x)]==0} { continue }
if {$x == "-global"} {
putidx $i "\002Global\002 Badwords"
} {
putidx $i "Badwords for channel \002$x\002"
}
set l 0
foreach y $badwords($x) {
putidx $i " $l: $y"
incr l
}
}
putidx $i "End of list."
return 1
} elseif {$chn == "save"} {
if {![matchattr $h $badword(cflag)]} {
putidx $i "Only global masters and above can save badwords."
return 1
}
badword:save "noautosave"
} elseif {$chn == "load"} {
if {![matchattr $h $badword(cflag)]} {
putidx $i "Only global masters and above can load badwords."
return 1
}
badword:load "noautoloaded"
} elseif {[regexp {^#.+$} $chn]} {
if {![matchattr $h $badword(cflag) $chn]} {
putidx $i "Only channel masters and above can list channel badwords."
return 1
}
if {[info exists badwords($chn)]} {
if {[llength $badwords($chn)]==0} {
putidx $i "No badwords for channel $chn."
} {
putidx $i "$chn badwords:"
set l 0
foreach x $badwords($chn) {
putidx $i "$l: $x"
incr l
}
putidx $i "End of list."
}
} {
putidx $i "No badwords for channel $chn."
}
#ist channel badwords
return 1
} else {
putidx $i "\002Syntax:\002 : badwords \[save|load|all|#channel\]"
return 0
}
}
proc badword:save {t} {
global badword badwords
set f [open $badword(savefile) w]
foreach x [array names badwords] {
if {[llength $badwords($x)]==0} { continue }
puts $f "=$x"
foreach y $badwords($x) {
puts $f "~$y"
}
}
close $f
if {$t != "save"} {
if {!$badword(quietsave)} { putlog "Saved badwords." }
}
}
proc badword:load {t} {
global badword badwords
catch { unset badwords }
set f [open $badword(savefile) r]
set curr "--"
while {![eof $f]} {
set ln [gets $f]
if {![regexp "^(\[=~\])(.+)$" $ln uun t r]} { continue }
if {$t == "="} {
set curr $r
} {
if {![info exists badwords($curr)]} {
set badwords($curr) [list $r]
} {
lappend badwords($curr) $r
}
}
}
close $f
putlog "Loaded badwords."
}
proc badword:msg {n u h c t} {
global badwords badword
set c [string tolower $c]
set hit 0
if {![channel get $c badwords]} { return 0 }
if {[isop $n $c]} { if {[channel get $c dontkickops]} { return 0 } }
if {[matchattr $h $badword(flag) $c]} { return 0 }
if {[info exists badwords(-global)]} {
foreach x $badwords(-global) {
if {[string trim $x] == ""} { continue }
if {[regexp -nocase $x $t]} { set hit 1 ; break }
}
}
if {!$hit && [info exists badwords($c)]} {
foreach x $badwords($c) {
if {[string trim $x] == ""} { continue }
if {[regexp -nocase $x $t]} { set hit 1 ; break }
}
}
if {$hit} {
if {$badword(reaction) == 1} {
newchanban $c [maskhost $u] "badwords" [join [lindex $badword(banmsg) [rand [llength $badword(banmsg)]]]] $badword(bantime)
} {
putserv "KICK $c $n :$badword(banmsg)"
}
}
}
putlog "Badwords by Elven loaded." |
|
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Dec 31, 2005 12:13 am Post subject: |
|
|
I told you (or did I?) to use xchannel, it does exactly what you need and I'd bet it does it better _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Sat Dec 31, 2005 5:55 am Post subject: |
|
|
| Really, you need to stop doing that demond |
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Sat Dec 31, 2005 12:17 pm Post subject: |
|
|
| demond wrote: | | I told you (or did I?) to use xchannel, it does exactly what you need and I'd bet it does it better |
the script it good but how activated desactivé directly on chan by !chanset #yourchan +x:repeat for expl
thx |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Dec 31, 2005 1:07 pm Post subject: |
|
|
| MeTroiD wrote: | | Really, you need to stop doing that demond |
what's your problem exactly?
if you had better badwords script, I wouldn't hesitate to recommend yours over mine _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Dec 31, 2005 1:15 pm Post subject: |
|
|
| stef007 wrote: | | demond wrote: | | I told you (or did I?) to use xchannel, it does exactly what you need and I'd bet it does it better |
the script it good but how activated desactivé directly on chan by !chanset #yourchan +x:repeat for expl
thx |
well, my philosophy is that an eggdrop bot should never be controlled via public commands, mainly for security reasons
therefore, xchannel is controlled (configured, to be precise) via DCC command .chanset only _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sat Dec 31, 2005 11:02 pm Post subject: |
|
|
| demond wrote: | | well, my philosophy is that an eggdrop bot should never be controlled via public commands, mainly for security reasons |
... and for reasons beyond the control of many users they are unable to enter the command console which is why public commands are preferred.
Some scripts are just totally useless under these circumstances. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Jan 01, 2006 6:06 am Post subject: |
|
|
| Alchera wrote: |
Some scripts are just totally useless under these circumstances. |
right
and they are intended to be that way, at least my scripts; as you know, I firmly believe that almost anyone should be able to fix their DCC, I bothered to elaborate on the subject over and over and over again and I'd do that again - we should educate users how to use eggdrop the way it was meant to be used, not to endorse scripts enabling any lamer out there to run eggdrop without having the slightest clue about its inner workings, or at least the console (note that I'm not denying public commands in general; they have great entertainment value, and they should stay that way - leave control functions to the console)
the only valid excuse for not being able to dcc is when both the user and the bot are behind firewalls not allowing listening ports; however, such situation simply doesn't happen in the vast majority of (legitimate) eggdrop use cases - there is no shell provider who would deny you listening port, and your ISP won't do that either; actually, the only scenario I could see that happening in is when you run eggdrop from hacked account on internal corporate machine, which you shouldn't do anyway
so essentially what I'm saying is that virtually any total inability to use DCC is due to lameness or/and laziness, and I'm not on these forums to encourage either _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Sun Jan 01, 2006 1:25 pm Post subject: |
|
|
MeTroiD wrote:
| Quote: | | Really, you need to stop doing that demond |
I think Demond and Sir_Fz ' are the great coders, their scripts are the best and bug free plus vast majority of users need these type of scripts so i think nothing wrong to tell the users to use these scripts. Also both of them are active @ this forum helping users and they know their problems very well so i think it's good to tell the person to use these 2 scripts so they can get the best scripts plus it will save their time as well and if they've any issue they can talk to them here. _________________ MM |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Jan 01, 2006 2:09 pm Post subject: |
|
|
demond : Well pointed! I got to admit that this stuff got annoyng. You know what I'm talking about.
Thread closed. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|