Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


[Bug] Badword issue
#1
i have 1 issue is loop every word and 1 error

Code:
Tcl error [pubm_badword]: can't read "badwords": no such variable
if someone can help i cant figure it thx in advance

tcl
set bwords (file) "badword.txt"; 
 
 
# Kick MSG 
set badword_msg "Bad Words" 
 
# Channels 
set badword_chans "#shqiperia # test1" 
 
bind pubm - * pubm_badword 
bind ctcp - ACTION ctcp_badword 
 
 
 
proc pubm_badword {nick hand uhost chan arg} { 
global badwords badword_msg badword_chans botnick 
 
set users 
 
set umasks 
 
 
 
set arg [string trim $arg]   
set arg [split $arg]   
 
set text [string tolower $arg]   
 
set ban_time 5   
 
if {(([lsearch -exact [string tolower $badword_chans] [string tolower $chan]]! = - 1) || ($badword_chans == "*")) && (! [Matchattr $hand b]) && ( $nick!  
 
 
 
 
if {[string match * $badword * $text] || [regexp -nocase $re $text]} {   
 
if {[set chost [getchanhost $nick $chan]] ne ""} {   
switch - glob - $chost {   
{* .irccloud.com} - {* .mibbit.com} - {* .kiwiirc.com} - {* .4999FD0E.IP} {   
set mask *! [index [split $chost @] 0] @ *   
}   
{default} {   
set mask [maskhost "$nick! $chost" 2] 
} 
} 
}   
lappend users $nick   
lappend umasks $mask   
 
set count [llength $users]   
set count [llength $umasks]   
putquick "MODE $chan - [string repeat" v "$count] + [string repeat" b "$count] [join $users] [join $umasks]"  
after [expr $ban_time * 1000 * 60] [list putserv "MODE $chan - [string repeat" b "$count] [join $umasks]"]   
 
#putserv "Kick $chan $nick: $badword_msg"   
return   
}   
}   
}   
}   
proc ctcp_badword {nick uhost hand chan keyword arg} {   
pubm_badword $nick $uhost $hand $chan $arg     
}   
 
if {! [file exists $bwords (file)]} {
set file [open $bwords (file) w]   
close $file   
} 
 
proc check_bwords {bwords} {   
global bwords   
set file [open $bwords (file) r]   
set fdata [split [read $file] \ n]   
close $file   
foreach entry $fdata {   
if {[string match $entry $bwords]} {  
return 1   
}   
}   
return 0   
}   
 
bind msg n | n ".badd" add_bword   
bind msg n | n ".bdel" del_bword   
bind msg n | n ".blist" list_bword   
bind msg n | n ".bhelp" help_bword   
 
 
 
proc add_bword {nick host hand text} {   
global bwords   
set text [index [split $text] 0]   
if {$text == ""} {   
putserv "NOTICE $nick \ 00314Perdor \ 0036: \ 002 \ 0034.bhelp \ 002 Per Me Shume Informacion." 
 
 
 
Set data [read $file]   
close $file   
set lines [lrange [split $data "\ n"] 0 end-1]   
set current_place [lsearch -exact $lines $text]   
if {$current_place! = "-1"} {  
putserv "NOTICE $nick \ 0035: \ 00314Kjo fjale \ 002 \ 0034 $text \ 002 \ 00314Ekziston E Shtuar Ne Listen E \ 002 \ 0034Badwords File \ 002." 
return   
}   
set file [open $bwords (file) a]   
puts $file $text   
close $file   
putserv "NOTICE $nick \ 0036: \ 00314Kjo fjale \ 002 \ 0034 $text \ 002 \ 00314U Shtua Me Sukses Ne Listen E \ 002 \ 0034Badwords File \ 002."} proc list_bword {nick host hand text} {global bwords   
 
 
 
 
 
set text [index [split $text] 0]   
set file [open $bwords (file) "r" 
 
close $file   
set data [lrange [split $read "\ n"] 0 end- 1]   
set i 0   
if {$data == ""} {  
putserv "Notice $nick \ 0036: \ 00314Nuk Ka Asnje \ 002 \ 0034fjale \ 002 \ 00314Te Shtuar Ne Listen E \ 002 \ 0034Badwords File \ 002."   
return   
}   
putserv "Notice $nick \ 0036: \ 00314 Keto fjale Jane Ne Listen E \ 002 \ 0034Badwords File \ 002." 
foreach line $data {   
set i [expr $i +1]   
putserv "NOTICE $nick: $i.) $Line"   
 
 
 
 
 
array set badworddel 
 
set file [open $bwords (file) "r"]   
set data [read $file]   
close $file   
set lines [lrange [split $data "\ n"   
 
if {$current_place == "-1"} {   
putserv "NOTICE $nick \ 0036: \ 00314Kjo fjale \ 002 \ 0034 $text \ 002 \ 00314nuk ekziston do not listen to \ 002 \ 0034Badwords File \ 002." 
return  
}   
set delete [lreplace $lines $current_place $current_place]   
set files [open $bwords (file) "w"]   
puts $files [join $delete "\ n"]   
flush $files   
close $files   
set file [open $bwords (file) "r"   
 
 
 
 
 
}
putserv "NOTICE $nick \ 0036:} proc help_bword {nick host hand text} {global bwords set text [index [split $text] 0] putserv" NOTICE $nick \ 0036: \ 00314Per Te Shtuar Nje Fjale Perdor Komanden \ 0036: \ 002 \ 0034.badd \ 0034 <\ 00314badword \ 0034> \ 002 " 
putserv " NOTICE $nick \ 0036: \ 00314Per Te Pare Listen \ 0034Badwords File \ 00314 Perdor Komanden \ 0036: \ 002 \ 0034.blist \ 002 "
putserv " NOTICE $nick \ 0036: \ 00314Per Te Hequr Nje Fjale Nga Lista e \ 0034Badwords File \ 00314 Perdor Komanden \ 0036: \ 002 \ 0034.bdel \ 0034 <\ 00314badword \ 0034> \ 002 "
} 
putlog "Badword loaded"

#2
You have a global badwords in your proc, but I can't find any place where this variable is setted.

And I don't know how you copy/paste your code here, but next time, just copy from your source file. And don't double post, it won't make us reply you faster.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
#3

Sorr yi am new in this forum i dont know how functions here till i learn
I am not a script tcl coders what to do now with this error cant be fix this error to set variable?
#4
Your script is incomplete due to your copy/paste, we can't help you with it.

You'd better give us a link to a paste.tclhelp.net as you done on #eggdrop.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
#5
#6
As previously said, the variable $badwords is never created nor filled, you just declare that it's a global variable.
Your script lacks an initialisation procedure to fill (and refresh) $badwords with the content of your file.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
#7
I think the errros comes from this set regex
when i remove it is work when i add is give me this errors

Tcl error [badwords: pubm]: can't read "badword": no such variable

set re [join [split $badword {}] {+ [^ a-zA-Z0-9] *}]

if {[string match * $badword * $ text] || [regexp -nocase $ re $ text]} {
#8
Well, your first post was: Tcl error [pubm_badword]: can't read "badwords": no such variable
Now, you have Tcl error [badwords: pubm]: can't read "badword": no such variable

$badword is set in foreach badword [string tolower $badwords] { so it exists if $badwords is set and no empty, else you won't enter the loop:

Code:
.tcl set badwords ""
Tcl:
.tcl foreach badword [string tolower $badwords] { putlog "*$badword*" }
Tcl:
.tcl set badwords "test another"
Tcl: test another
.tcl foreach badword [string tolower $badwords] { putlog "*$badword*" }
[14:27] *test*
[14:27] *another*
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
#9
i did a new one but is not set ban when u have time to give 1 look what i did wrong and how to fix it

is set ban only in exact word 

[17:52:14] <Test1> Stupid

[17:52:14] * Nasa sets mode: + b *! Uid465250 @ *

[17:52:30] <VIRUS> stupid
[5:52:30 PM] * Nasa sets mode: + b *!*@nasa.army-3F8BE0D0.access.hol.gr

but for this patterns is not set ban not match
s t u p i d
st-up-id 
ssstuuupid

http://paste.tclhelp.net/?id=6llg
#10
Already explained in IRC: trying to match s t u p i d is really dangerous: you'll have to remove all the spaces in the line and check if it matches *stupid*. The risk is to have a lot of false positive.
Example (in french): badword is "con" and someone say "donc on fait quoi?". Without spaces, it gives "donconfaitquoi?" and it matches.

For the two others, I already gave you the regexp to use:

Code:
2020-11-13 13:47:47  @CrazyCat   .tcl set text "s-t-u-p-i-d"
2020-11-13 13:47:47  @CrazyCat   Tcl: s-t-u-p-i-d
2020-11-13 13:47:47  @CrazyCat   .tcl regsub -all -- {-} $text {} text
2020-11-13 13:47:47  @CrazyCat   Tcl: 5
2020-11-13 13:47:47  @CrazyCat   .tcl putlog $text
2020-11-13 13:47:47  @CrazyCat   [13:47] stupid
2020-11-13 13:49:13  @CrazyCat   .tcl set text "sssssttttttuuuuuppppiiiidddd"
2020-11-13 13:49:13  @CrazyCat   Tcl: sssssttttttuuuuuppppiiiidddd
2020-11-13 13:49:13  @CrazyCat   .tcl regsub -all -- {(.)\1+} $text {\1} text
2020-11-13 13:49:13  @CrazyCat   Tcl: 6
2020-11-13 13:49:13  @CrazyCat   .tcl putlog $text
2020-11-13 13:49:13  @CrazyCat   [13:49] stupid
So use:

tcl
# remove all -
regsub -all -- {-} $text {} text
# remove all duplicates letters (let 1 of them)
tcl regsub -all -- {(.)\1+} $text {\1} text

zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
#11
I fixed thx

http://paste.tclhelp.net/?id=6llg

[18:35:37] <VIRUS> s tu-pid]
[18:35:37] * Nasa sets mode: + b *!*@nasa.army-3F8BE0D0.access.hol.gr
[18:36:30] <Test1> Stup id
[18:36:30] * Nasa sets mode: + b *! Uid465250 @ *

[18:38:07] <VIRUS> shiscute
[18:38:11] <VIRUS> sh it
[18:38:11] * Nasa sets mode: + b *!*@nasa.army-3F8BE0D0.access.hol.gr

[18:39:15] <VIRUS> i have to work the late shift
[18:39:17] <VIRUS> sh it
[18:39:17] * Nasa sets mode: + b *!*@nasa.army-3F8BE0D0.access.hol.gr

and action ctcp cant match badword

but how to make a alias letters replacement

to match and this patterns when they replace letters with other letters char numbers?
[06:46:25] <VIRUS> sh1t

i = 1! l |
a = 4 @
e = 3
o = 0
s = $ 5

ctcp actions is not match badwords
actual code i have now


tcl
### ++++ Script name: Badwords
#
#####################################################
#
# New Commands  (Public or Message)
#		.bw #channel/global on/off
#		.bw #channel/global ban-reason REASON
#		.bw #channel/global ban-type 1/2/3/4
#		.bw #channel/global add WORD/PHRASE
#		.bw #channel/global del WORD/PHRASE
#		.bw #channel/global list
#
#####################################################
 
setudef flag badwords
 
 
bind MSG n .bw badwords:msg
 
bind ctcp - ACTION ctcp_badwords
 
proc badwords:msg {nick uhost hand arg} {
	badwords:pub $nick $uhost $hand "" $arg
}
 
 
proc badwords:pub {nick uhost hand chan arg} {
	global badwords tempbw
 
	if {$chan eq ""} {  set sendto $nick ;  set pre ""
	} else {  set sendto $chan ;  set pre "\002$nick\002 - "  }
 
	set alist [split [string trim $arg]]
	set opt [string tolower [lindex $alist 0]]
 
	if {[string match "#*" $opt] || $opt eq "global" || $opt eq "glob"} {
		if {[string match "g*" $opt]} {  set target "global"
		} else {
			if {![validchan $opt]} {
				putserv "PRIVMSG $sendto :${pre}$opt is not a valid channel."; return
			}
			set target $opt
		}
		set alist [lrange $alist 1 end]
		set opt [string tolower [lindex $alist 0]]
 
	} elseif {$chan eq ""} {  set target "global"
	} else {  set target [string tolower $chan]  }
 
	#putlog "chan=$chan||arg=$arg|<>|sendto=$sendto||opt=$opt||target=$target||alist=$alist||"
 
	set word [lindex $alist 1]
	set words [string trim [join [lrange $alist 1 end]]]
 
 
	switch -exact -- $opt {
		ban-type -
		-ban-type {
			if {$word eq ""} { putserv "PRIVMSG $sendto :${pre}You have to specify ban-type (1/2/3/4)"; return }
			if {![regexp {^(1|2|3|4)$} $word]} {
				putserv "PRIVMSG $sendto :${pre}valid types are 1/2/3 or 4 (!badwords ban-type 2)"; return
			}
 
			set tempbw($target,ban-type) $word
			badwords:save
			putserv "PRIVMSG $sendto :${pre}$target 'ban-type' has been SET"
		}
		-r -
		-reason {
			if {$word eq ""} { putserv "PRIVMSG $sendto :${pre}You have to specify a ban-reason"; return }
 
			set tempbw($target,reason) $words
			badwords:save
			putserv "PRIVMSG $sendto :${pre}$target 'ban-reason' has been SET"
		}
		on -
		-on {
			if {$target eq "global"} {
				foreach ch [channels] {  channel set $ch +badwords  }
				putserv "PRIVMSG $sendto :${pre}Succesfully activated \00303badwords\003 script on all channels."
			} else {  channel set $target +badwords
				putserv "PRIVMSG $sendto :${pre}Succesfully activated \00303badwords\003 script on $target"
			}
		}
		off -
		-off {
			if {$target eq "global"} {
				foreach ch [channels] {  channel set $ch -badwords  }
				putserv "PRIVMSG $sendto :${pre}Succesfully deactivated \00303badwords\003 script on all channels."
			} else {  channel set $target -badwords
				putserv "PRIVMSG $sendto :${pre}Succesfully deactivated \00303badwords\003 script on $target"
			}
		}
		add -
		-add {
			if {$word eq ""} { putserv "PRIVMSG $sendto :${pre}You have to specify a badword to add."; return }
 
			set isbad [string tolower $words]
			if {[info exists badwords($target,$isbad)]} {
				putserv "PRIVMSG $sendto :${pre}'\00312$isbad\003' already exists in the $target database."
				return
			}
 
			set badwords($target,$isbad) "[unixtime] $nick"
			badwords:save
			putserv "PRIVMSG $sendto :${pre}Succesfully added '\00312$isbad\003' into the $target database."
		}
		del -
		-del {
			if {$word eq ""} { putserv "PRIVMSG $sendto :${pre}You have to specify a badword to delete."; return }
 
			set isbad [string tolower $words]
			if {![info exists badwords($target,$isbad)]} {
				putserv "PRIVMSG $sendto :${pre}'\00312$isbad\003' was not found in the $target database."
				return
			}
 
			unset -nocomplain badwords($target,$isbad)
			badwords:save
			putserv "PRIVMSG $sendto :${pre}Succesfully removed '\00312$isbad\003' from the $target database."
		}
		list -
		-list {
			set temp(list) ""
			foreach b [array names badwords $target,*] { lappend temp(list) [lindex [split $b ,] 1] }
			if {$temp(list) eq ""} {
				putserv "PRIVMSG $sendto :${pre}Badwords database for \00303$target\003 is \002empty\002"
				return
			}
 
			putserv "PRIVMSG $sendto :${pre}$target \00303badwords\003: [join $temp(list) ", "]"
		}
		reset -
		-reset {
			array unset badwords "$target,*"
 
			badwords:save
			putserv "PRIVMSG $sendto :${pre}Succesfully RESET $target badwords."
		}
	}
}
 
 
bind PUBM - * badwords:pubm
 
proc badwords:pubm {nick uhost hand chan arg} {
	global badwords tempbw
 
	if {![channel get $chan badwords] || ![botisop $chan] || [matchattr $hand mn] || [isop $nick $chan]} {
		return 0
	}
	set chan [string tolower $chan]
	set clist [array names badwords "$chan,*"]
	set glist [array names badwords "global,*"]
 
	set users [list]
	set umasks [list]
 
 
	set arg [string trim $arg]
	set arg [split $arg]
 
 
	set text [string tolower $arg]
 
	set ban_time 5
 
	foreach b [concat $clist $glist] {
 
		set re [join [split [lindex [split $b ,] 1] {}] {+[^a-zA-Z0-9]*}]
 
		if {[string match -nocase "*[lindex [split $b ,] 1]*" $arg] || [regexp -nocase $re $text]} {
 
			if {[info exists tempbw($chan,ban-type)]} {  set bantype $tempbw($chan,ban-type)
			} elseif {[info exists tempbw(global,ban-type)]} {  set bantype $tempbw(global,ban-type)
			} else {  set bantype 2  }
 
			if {[info exists tempbw($chan,reason)]} {  set reason $tempbw($chan,reason)
			} elseif {[info exists tempbw(global,reason)]} {  set reason $tempbw(global,reason)
			} else {  set reason "Go sit in the corner"  }
 
			if {[set chost $uhost] ne ""} {
				switch -glob -- $chost {
					{*.irccloud.com} - {*.mibbit.com} - {*.kiwiirc.com} {
						set mask *![lindex [split $chost @] 0]@*
					}
					{default} {
						set mask [maskhost "$nick!$chost" 2]
					}
				}
			}
			lappend users $nick
			lappend umasks $mask
 
			set count [llength $users]
			set count [llength $umasks]
			putquick "MODE $chan -[string repeat "v" $count]+[string repeat "b" $count] [join $users] [join $umasks]"
			after [expr $ban_time*1000*60] [list putserv "MODE $chan -[string repeat "b" $count] [join $umasks]"]
 
			#putserv "Kick $chan $nick :$badword_msg"
 
			return 0
		}
	}
}
 
 
proc ctcp_badwords {nick uhost hand chan key arg} {
       proc badwords:pubm {nick uhost hand chan arg} {
 
   } 
}
 
 
 
proc mh {nuhost type} {
	lassign [split $nuhost !@] n u h
 
	switch $type {
		1 {return $nuhost}
		2 {return *!*@$h}
		3 {return *!*$u@$h}
		4 {return *!*$u@*}
	}
}
 
 
proc badwords:save {} {
	global badwords tempbw
 
	set ofile [open badwords w]
	puts $ofile "array set badwords [list [array get badwords]]"
	puts $ofile "array set tempbw [list [array get tempbw]]"
	close $ofile
}
 
catch {source badwords}
 
 
putlog "Succesfully loaded: \00312Badwords TCL Script"

#12

tcl
proc ctcp_badwords {nick uhost hand chan key arg} {
       proc badwords:pubm {nick uhost hand chan arg} {
   } 
}


WTF ?

In your own code, you have a (nearly) working part:

tcl
proc badwords:msg {nick uhost hand arg} {
	badwords:pub $nick $uhost $hand "" $arg
}


If that's your code you may know how to do the right call...

And for your "translation", use string map to convert:

Code:
.tcl set leet {"4" "a" "@" "a" "3" "e" "0" "o" "$" "s" "5" "s"}
Tcl: "4" "a" "@" "a" "3" "e" "0" "o" "$" "s" "5" "s"
.tcl set lt "@n0th3r"
Tcl: @n0th3r
.tcl set letters [string map $leet $lt]
Tcl: another
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
#13
ok i fixed and bind ctcp action thx for advices

i dont know how to add this code 


.tcl set leet {"4" "a" "@" "a" "3" "e" "0" "o" "$" "s" "5" "s"}

Tcl: "4" "a" "@" "a" "3" "e" "0" "o" "$" "s" "5" "s"

.tcl set lt "@ n0th3r"

Tcl: @ n0th3r

.tcl set letters [string map $ leet $ lt]
Tcl: another



tcl
### ++++ Script name: Badwords
#
########################################## # # #
#
# New Commands (Public or Message)
# .bw # channel / global on / off
# .bw # channel / global ban-reason REASON
# .bw # channel / global ban-type 1/2/3/4
# .bw # channel / global add WORD / PHRASE
# .bw # channel / global del WORD / PHRASE
# .bw # channel / global list
#
########################################## # # #
 
setudef flag badwords
 
set leet {"4" "a" "@" "a" "3" "e" "0" "o" "$" "s" "5" "s" "1" "i" "!" "i" "l" "i" "|" "i" "v" "u" "\ /" "u" "| _ |" "u" "| <" "k" "\ <" "k" "/ <" "k" "c" "k" "q" "k" "ç" "k"}
 
set arg "????"
 
set letters [string map $ leet $ arg]
 
 
bind MSG n .bw badwords: msg
 
bind ctcp - ACTION ctcp_badwords
 
proc ctcp_badwords {nick uhost hand chan key arg} {
      badwords: pubm $ nick $ uhost $ hand $ chan $ arg
}
 
 
proc badwords: msg {nick uhost hand arg} {
badwords: pub $ nick $ uhost $ hand "" $ arg
}
 
 
proc badwords: pub {nick uhost hand chan arg} {
global badwords tempbw
 
if {$ chan eq ""} {set sendto $ nick; set pre ""
} else {set sendto $ chan; set pre "\ 002 $ nick \ 002 -"}
 
set alist [split [string trim $ arg]]
set opt [string tolower [lindex $ alist 0]]
 
if {[string match "# *" $ opt] || $ opt eq "global" || $ opt eq "glob"} {
if {[string match "g *" $ opt]} {set target "global"
} else {
if {! [validchan $ opt]} {
putserv "PRIVMSG $ sendto: $ {pre} $ opt is not a valid channel."; return
}
set target $ opt
}
set alist [lrange $ alist 1 end]
set opt [string tolower [lindex $ alist 0]]
 
} elseif {$ chan eq ""} {set target "global"
} else {set target [string tolower $ chan]}
 
#putlog "chan = $ chan || arg = $ arg | <> | sendto = $ sendto || opt = $ opt || target = $ target || alist = $ alist ||"
 
set word [index $ alist 1]
set words [string trim [join [lrange $ alist 1 end]]]
 
 
switch -exact - $ opt {
ban-type -
-ban-type {
if {$ word eq ""} {putserv "PRIVMSG $ sendto: $ {pre} You have to specify ban-type (1/2/3/4)"; return}
if {! [regexp {^ (1 | 2 | 3 | 4) $} $ word]} {
putserv "PRIVMSG $ sendto: $ {pre} valid types are 1/2/3 or 4 (! badwords ban-type 2)"; return
}
 
set tempbw ($ target, ban-type) $ word
badwords: save
putserv "PRIVMSG $ sendto: $ {pre} $ target 'ban-type' has been SET"
}
-r -
-reason {
if {$ word eq ""} {putserv "PRIVMSG $ sendto: $ {pre} You have to specify a ban-reason"; return}
 
set tempbw ($ target, reason) $ words
badwords: save
putserv "PRIVMSG $ sendto: $ {pre} $ target 'ban-reason' has been SET"
}
we -
-we {
if {$ target eq "global"} {
foreach ch [channels] {channel set $ ch + badwords}
putserv "PRIVMSG $ sendto: $ {pre} Succesfully activated \ 00303badwords \ 003 script on all channels."
} else {channel set $ target + badwords
putserv "PRIVMSG $ sendto: $ {pre} Succesfully activated \ 00303badwords \ 003 script on $ target"
}
}
off -
-off {
if {$ target eq "global"} {
foreach ch [channels] {channel set $ ch -badwords}
putserv "PRIVMSG $ sendto: $ {pre} Succesfully deactivated \ 00303badwords \ 003 script on all channels."
} else {channel set $ target -badwords
putserv "PRIVMSG $ sendto: $ {pre} Succesfully deactivated \ 00303badwords \ 003 script on $ target"
}
}
add -
{-add
if {$ word eq ""} {putserv "PRIVMSG $ sendto: $ {pre} You have to specify a badword to add."; return}
 
set isbad [string tolower $ words]
if {[info exists badwords ($ target, $ isbad)]} {
putserv "PRIVMSG $ sendto: $ {pre} '\ 00312 $ isbad \ 003' already exists in the $ target database."
return
}
 
set badwords ($ target, $ isbad) "[unixtime] $ nick"
badwords: save
putserv "PRIVMSG $ sendto: $ {pre} Succesfully added '\ 00312 $ isbad \ 003' into the $ target database."
}
of the -
-of the {
if {$ word eq ""} {putserv "PRIVMSG $ sendto: $ {pre} You have to specify a badword to delete."; return}
 
set isbad [string tolower $ words]
if {! [info exists badwords ($ target, $ isbad)]} {
putserv "PRIVMSG $ sendto: $ {pre} '\ 00312 $ isbad \ 003' was not found in the $ target database."
return
}
 
unset -nocomplain badwords ($ target, $ isbad)
badwords: save
putserv "PRIVMSG $ sendto: $ {pre} Succesfully removed '\ 00312 $ isbad \ 003' from the $ target database."
}
list -
-list {
set temp (list) ""
foreach b [array names badwords $ target, *] {lappend temp (list) [lindex [split $ b,] 1]}
if {$ temp (list) eq ""} {
putserv "PRIVMSG $ sendto: $ {pre} Badwords database for \ 00303 $ target \ 003 is \ 002empty \ 002"
return
}
 
putserv "PRIVMSG $ sendto: $ {pre} $ target \ 00303badwords \ 003: [join $ temp (list)", "]"
}
reset -
-reset {
array unset badwords "$ target, *"
 
badwords: save
putserv "PRIVMSG $ sendto: $ {pre} Succesfully RESET $ target badwords."
}
}
}
 
 
bind PUBM - * badwords: pubm
 
proc badwords: pubm {nick uhost hand chan arg} {
global badwords tempbw
 
if {! [channel get $ chan badwords] || ! [botisop $ chan] || [matchattr $ hand mn] || [isop $ nick $ chan]} {
return 0
}
set chan [string tolower $ chan]
set clist [array names badwords "$ chan, *"]
set glist [array names badwords "global, *"]
 
set users [list]
set umasks [list]
 
 
set arg [string trim $ arg]
set arg [split $ arg]
 
 
set text [string tolower $ arg]
 
set ban_time 5
 
foreach b [concat $ clist $ glist] {
 
set re [join [split [index [split $ b,] 1] {}] {+ [^ a-zA-Z0-9] *}]
 
if {[string match -nocase "* [lindex [split $ b,] 1] *" $ arg] || [regexp -nocase $ re $ text]} {
 
if {[info exists tempbw ($ chan, ban-type)]} {set bantype $ tempbw ($ chan, ban-type)
} elseif {[info exists tempbw (global, ban-type)]} {set bantype $ tempbw (global, ban-type)
} else {set bantype 2}
 
if {[info exists tempbw ($ chan, reason)]} {set reason $ tempbw ($ chan, reason)
} elseif {[info exists tempbw (global, reason)]} {set reason $ tempbw (global, reason)
} else {set reason "Go sit in the corner"}
 
if {[set chost $ uhost] ne ""} {
switch -glob - $ chost {
{* .irccloud.com} - {* .mibbit.com} - {* .kiwiirc.com} {
set mask *! [index [split $ chost @] 0] @ *
}
{default} {
set mask [maskhost "$ nick! $ chost" 2]
}
}
}
lappend users $ nick
lappend umasks $ mask
 
set count [llength $ users]
set count [llength $ umasks]
putquick "MODE $ chan - [string repeat" v "$ count] + [string repeat" b "$ count] [join $ users] [join $ umasks]"
after [expr $ ban_time * 1000 * 60] [list putserv "MODE $ chan - [string repeat" b "$ count] [join $ umasks]"]
 
#putserv "Kick $ chan $ nick: $ badword_msg"
 
return 0
}
}
}
 
 
proc mh {nuhost type} {
lassign [split $ nuhost! @] nuh
 
switch $ type {
1 {return $ nuhost}
2 {return *! * @ $ H}
3 {return *! * $ U @ $ h}
4 {return *! * $ U @ *}
}
}
 
 
proc badwords: save {} {
global badwords tempbw
 
set ofile [open badwords w]
puts $ ofile "array set badwords [list [array get badwords]]"
puts $ ofile "array set tempbw [list [array get tempbw]]"
close $ ofile
}
 
catch {source badwords}
 
 
putlog "Succesfully loaded: \ 00312Badwords TCL Script"

#14
You said:
(20/11/2020, 17:22)AlbozZ Wrote: i did a new one
If you really have done the script, you're able to implement the two regsub I gave you.
If you just found a script and say it's yours, I can't help you.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
#15
I didnt say the script is mine i just modificate it how i want and need to be for some purpose matches patterns


Forum Jump:


Users browsing this thread: 1 Guest(s)