📄 swkick.txt
字号:
;@@@
;@@@ DreamBot IRC Bot 5.1
;@@@ File description: channel swear protection
;@@@ Design & coding: Madar Petru
;@@@ (C) Copyright 2004-2005 by Madar Petru. All rights reserved.
;@@@
on 400:text:*swearkick*:#: {
if ($1 == %c $+ swearkick) {
if ($2 == $null) { .msg $nick Command incomplete. Syntax: %c $+ swearkick <on|off>. | halt }
if ($2 !== $null) {
if ($2 == on) { writeini -n ini\channels.ini $chan Swear On | .msg $nick Swear protection for $chan set to ON. | halt }
if ($2 == off) { writeini -n ini\channels.ini $chan Swear Off | .msg $nick Swear protection for $chan set to OFF. | halt }
else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
}
}
}
on 400:text:swearkick*:?: {
if ($1 == swearkick) {
if ($2 == $null) { .msg $nick Command incomplete. Syntax: /msg $me swearkick <#channel> <on|off>. | halt }
if ($2 !== $null) && ($3 !== $null) {
if ($3 == on) { writeini -n ini\channels.ini $2 swear On | .msg $nick Swear protection for $2 set to ON. | halt }
if ($3 == off) { writeini -n ini\channels.ini $2 swear Off | .msg $nick Swear protection for $2 set to OFF. | halt }
else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
}
}
}
alias bw_dialog { dialog -ma badwords badwords }
dialog badwords {
title "DreamBot bad word list"
icon "img\set.ico", 0
size -1 -1 300 250
text " This tool allows you to add/remove bad words to a list. When Swear Protection is enabled and these words are detected in a prhase, the bot will react by warning and then banning the user.", 1, 5 5 290 60
edit "", 2, 110 65 140 20
list 3, 110 90 140 150, sort
button "Add", 4, 5 100 75 25
button "Remove", 5, 5 130 75 25
button "Close", 6, 5 200 75 25, cancel
}
alias _loadwords {
did -r badwords 2,3
if $exists(ini\bword.txt) == $false { halt }
set %file ini\bword.txt
set %bwcount 0
:addword
inc %bwcount
if $read(%file,%bwcount) == $null { halt }
did -a badwords 3 $read(%file,%bwcount)
did -ra badwords 2 $read(%file,%bwcount)
goto addword
}
on *:dialog:badwords:init:0: {
_loadwords
}
on *:dialog:badwords:sclick:3: {
if $did(badwords,3).seltext == $null { halt }
did -ra badwords 2 $did(badwords,3).seltext
}
alias _bword {
if $exists(ini\bword.txt) == $false { return $false }
set %file ini\bword.txt
set %bwcount 0
:checkword
inc %bwcount
if $read(%file,%bwcount) == $null { return $false }
if $read(%file,%bwcount) == $1- { return $true }
goto checkword
}
on *:dialog:badwords:sclick:4: {
if $did(badwords,2).text == $null { _error You didn't entered any word to add. | halt }
set %bw $did(badwords,2).text
if $_bword(%bw) == $true { _error That word already exists! | halt }
write ini\bword.txt %bw
_loadwords
}
on *:dialog:badwords:sclick:5: {
if $did(badwords,2).text == $null { _error You didn't entered any word to delete. | halt }
set %bw $did(badwords,2).text
if $_bword(%bw) == $false { _error That word does not exist! | halt }
write -ds $+ %bw ini\bword.txt
_loadwords
}
alias _match.bad.word {
set %text $1-
set %file ini\bword.txt
set %bwcount 0
:nextword
inc %bwcount
if $read(%file,%bwcount) == $null { return $false }
if $read(%file,%bwcount) isin %text || $read(%file,%bwcount) iswm %text { return $true }
goto nextword
}
on @+1!:text:*:#: {
if $nick isop $chan { halt }
if $_protect(swear,$chan) == $false { halt }
if $_match.bad.word($strip($1-)) == $false { halt }
; begin punishments
; 1 = warn, kick ban
; 2 = warn, kick
; 3 = kick ban
if %kb.method == 1 {
; check user
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick swear | halt }
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == 1 { qbadd $chan $address($nick,2) $nick }
}
if %kb.method == 2 {
; check user
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick swear | halt }
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == 1 { qkadd $chan $nick }
}
if %kb.method == 3 {
; check user
qbadd $chan $address($nick,2) $nick | halt
}
}
on @+1!:action:*:#: {
if $nick isop $chan { halt }
if $_protect(swear,$chan) == $false { halt }
if $_match.bad.word($strip($1-)) == $false { halt }
; begin punishments
; 1 = warn, kick ban
; 2 = warn, kick
; 3 = kick ban
if %kb.method == 1 {
; check user
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick swear | halt }
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == 1 { qbadd $chan $address($nick,2) $nick }
}
if %kb.method == 2 {
; check user
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick swear | halt }
if %p.swearW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == 1 { qkadd $chan $nick }
}
if %kb.method == 3 {
; check user
qbadd $chan $address($nick,2) $nick | halt
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -