⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 advkick.txt

📁 在上载一个bot源码给喜欢研究僵尸网络的朋友
💻 TXT
字号:
;@@@
;@@@ DreamBot IRC Bot 5.1
;@@@ File description: channel advertisements protection
;@@@ Design & coding: Madar Petru
;@@@ (C) Copyright 2004-2005 by Madar Petru. All rights reserved. 
;@@@

on 400:text:*advkick*:#: {
  if ($1 == %c $+ advkick) {
    if ($2 == $null) { .msg $nick Command incomplete. Syntax: %c $+ advkick <on|off>. | halt }
    if ($2 !== $null) {
      if ($2 == on) { writeini -n ini\channels.ini $chan Adv On | .msg $nick Advertisement protection for $chan set to ON. | halt }
      if ($2 == off) { writeini -n ini\channels.ini $chan Adv Off | .msg $nick Advertisement protection for $chan set to OFF. | halt }
      else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
    }
  }
}
on 400:text:advkick*:?: {
  if ($1 == advkick) {
    if ($2 == $null) { .msg $nick Command incomplete. Syntax: /msg $me advkick <#channel> <on|off>. | halt }
    if ($2 !== $null) && ($3 !== $null) {
      if ($3 == on) { writeini -n ini\channels.ini $2 Adv On | .msg $nick Advertisement protection for $2 set to ON. | halt }
      if ($3 == off) { writeini -n ini\channels.ini $2 Adv Off | .msg $nick Advertisement protection for $2 set to OFF. | halt }
      else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
    }
  }
}
alias ad_dialog { dialog -ma spam_filter spam_filter }
dialog spam_filter {
  title "DreamBot spam filter"
  icon "img\set.ico", 0
  size -1 -1 300 250
  text "    This tool allows you to add filters that will protect your channels from spam. The bot will first warn users, then it will ban them. You can even specify wildcards.", 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 _loadspam {
  did -r spam_filter 2,3
  if $exists(ini\aword.txt) == $false { halt }
  set %file.a ini\aword.txt
  set %awcount 0
  :addspam
  inc %awcount
  if $read(%file.a,%awcount) == $null { halt }
  did -a spam_filter 3 $read(%file.a,%awcount)
  did -ra spam_filter 2 $read(%file.a,%awcount)
  goto addspam
}
on *:dialog:spam_filter:init:0: {
  _loadspam
}
on *:dialog:spam_filter:sclick:3: {
  if $did(spam_filter,3).seltext == $null { halt }
  did -ra spam_filter 2 $did(spam_filter,3).seltext
}
alias _aword {
  if $exists(ini\aword.txt) == $false { return $false }
  set %file.a ini\aword.txt
  set %awcount 0
  :checkspam
  inc %awcount
  if $read(%file.a,%awcount) == $null { return $false }
  if $read(%file.a,%awcount) == $1- { return $true }
  goto checkspam
}
on *:dialog:spam_filter:sclick:4: {
  if $did(spam_filter,2).text == $null { _error You didn't entered any filter to add. Example: *www* | halt }
  set %aw $did(spam_filter,2).text
  if $_aword(%aw) == $true { _error That filter already exists! | halt }
  write ini\aword.txt %aw
  _loadspam
}
on *:dialog:spam_filter:sclick:5: {
  if $did(spam_filter,2).text == $null { _error You didn't entered any filter to delete. | halt }
  set %aw $did(spam_filter,2).text
  if $_aword(%aw) == $false { _error That filter does not exist! | halt }
  write -ds $+ %aw ini\aword.txt
  _loadspam
}
alias _match.spam.filter {
  set %text.a $1-
  set %file.a ini\aword.txt
  set %awcount 0
  :nextspam
  inc %awcount
  if $read(%file.a,%awcount) == $null { return $false }
  if $read(%file.a,%awcount) isin %text.a || $read(%file.a,%awcount) iswm %text.a { return $true }
  goto nextspam
}
on @+1!:text:*:#: {
  if $nick isop $chan { halt }
  if $_protect(adv,$chan) == $false { halt }
  if $_match.spam.filter($strip($1-)) == $false { halt }

  ; begin punishments
  ; 1 = warn, kick ban
  ; 2 = warn, kick
  ; 3 = kick ban

  if %kb.method == 1 {
    ; check user
    if %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick ad |  halt }
    if %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == 1 { qbadd $chan $address($nick,2) $nick }
  }

  if %kb.method == 2 {
    ; check user
    if %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick ad |  halt }
    if %p.advW [ $+ [ $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(adv,$chan) == $false { halt }
  if $_match.spam.filter($strip($1-)) == $false { halt }

  ; begin punishments
  ; 1 = warn, kick ban
  ; 2 = warn, kick
  ; 3 = kick ban

  if %kb.method == 1 {
    ; check user
    if %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick ad |  halt }
    if %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == 1 { qbadd $chan $address($nick,2) $nick }
  }

  if %kb.method == 2 {
    ; check user
    if %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] == $null { set %p.advW [ $+ [ $chan ] ] [ $+ [ $nick ] ] 1 | _warn $chan $nick ad |  halt }
    if %p.advW [ $+ [ $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 + -