All pastes #735313 Raw Edit

Something

public text v1 · immutable
·published 2007-10-13 14:38 UTC
rendered paste body
# *******************************************
# *                                         *
# *              AntiPub.tcl                *
# *     By TidZ` : Contact@EvilsNeT.Org     *     
# *            Irc.EvilsNeT.Org             *
# *                                         *
# *******************************************
# *		      	                    *
# *        ~ Description Du Script ~        *
# *                                         *
# * Ce script est très simple. Une liste de *
# * mot "pubs" est définie. Si un mot de la *
# * liste est pronocé dans une phrase sur   *
# * sur un salon où le bot à un accès, la   *
# * personne se fera devoice, kick ou ban.  *
# *                                         *
# *******************************************

# * * Configurations * *

# * Indiquez ici la durée du dévoice (en secondes). *
set devtime "60"

# * Indiquez ici la durée du ban (en secondes). *
set bantime "300"

# * Choisissez votre type de sanction.
# * Mettre à 1 pour avertissement
# * Mettre à 2 pour dévoice
# * Mettre à 3 pour kick
# * Mettre à 4 pour ban
set appuntype "2"

# * Définissez les mots "pub". Continuer la liste sous la meme forme. *
set pubs {
  "*#*"
  "*www.*"
  "*http:/*"
  "*h*t*t*p*:*/*/"
  "*https:/*"
  "*irc.*"
  "*irc:/*"
  "*.com*"
  "*.fr*"
  "*.be*"
  "*.org*"
  "*.net*"
  "*.ch*"
  "*.info*"
  "*.nl*"
  "*.ru*"
  "*.eu*"
  "*.ws*"
  "*.uk*"
}

# *
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * Ne pas toucher au bas de cette ligne. Toutes modifications peuvent entrainer un mauvais fonctionnement  * 
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# *


# * * Les Binds * *

bind pub - !ap AntiPub:ap
bind pubm - * pub:AntiPub


# * * Les Procédures * *

set ap "on"
set flags "m|m"
set file "scripts/compt.txt"

if {![file exists $file]} {
  set nbk 0
} else {
  set rnum [open $file r]
  set nbk [read -nonewline $rnum]
  close $rnum
}

proc AntiPub:ap {nick uhost hand chan arg} {
  global ap appuntype puntime timepun typepun devtime bantime
  set qap [lindex $arg 0]
  if {$qap == "on"} {
    if {![isop $nick $chan]} { putserv "NOTICE $nick :\00314Access \0034refusé."; return }
    set ap "on"
    putserv "privmsg $chan :\00314AntiPub \0033Activé\00314!"
  }
  if {$qap == "off"} {
    if {![isop $nick $chan]} { putserv "NOTICE $nick :\00314Access \0034refusé."; return }
    set ap "off"
    putserv "privmsg $chan :\00314AntiPub \0034Désactivé\00314!"
  }
  if {$qap == "aide" || $qap =="help"} {
    if {![isop $nick $chan]} {
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap timepun \00314Donne le temps de sanction sur le type en cours."
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap typepun \00314Donne le type de sanction en cours."
    }
    if {[isop $nick $chan]} {
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap timepun \00314Donne le temps de sanction sur le type en cours."
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap typepun \00314Donne le type de sanction en cours."
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap on \00314Active l'AntiPub."
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap off \00314Désactive l'AntiPub."
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap puntime <temps en seconde> \00314Défini le temps de sanction du type en cours."
      putserv "notice $nick :\0034Aide AntiPub \00314- \0033!ap appuntype <n° du type> \00314Défini le type de sanction. (sans le n°, donne la liste des types)"
    }
  }
  if {$qap == "puntime"} {
    set timepun [lindex $arg 1]
    if {![isop $nick $chan]} { putserv "NOTICE $nick :\00314Access \0034refusé."; return }
    if {$ap == "off"} { putserv "NOTICE $nick :\00314L'AntiPub est actuellement \0034Désactivé\00314. Pour définir le temps de sanction, il doit être \0033activé\00314 !"; return }
    if {$timepun == ""} { putserv "privmsg $chan :\00314Tu dois définir le temps de sanction en \0033seconde\00314 !"; return }
    if {$timepun != "" && $appuntype == "1"} {
      putserv "notice $nick :\00314Le type de sanction est défini sur avertissement. Donc le temps n'as pas d'effet."
    }
    if {$timepun != "" && $appuntype == "2"} {
      set devtime "$timepun"
      putserv "privmsg $chan :\00314Le temps de dévoice est maintenant de\0033 [expr $devtime / 60] minutes\00314."
    }
    if {$timepun != "" && $appuntype == "3"} {
      putserv "notice $nick :\00314Le type de sanction est défini sur kick. Donc le temps n'as pas d'effet."
    }
    if {$timepun != "" && $appuntype == "4"} {
      set bantime "$timepun"
      putserv "privmsg $chan :\00314Le temps de ban est maintenant de\0033 [expr $bantime / 60] minutes\00314."
    }
  }
  if {$qap == "puntype"} {
    set typepun [lindex $arg 1]
    if {![isop $nick $chan]} { putserv "NOTICE $nick :\00314Access \0034refusé."; return }
    if {$ap == "off"} { putserv "NOTICE $nick :\00314L'AntiPub est actuellement \0034Désactivé\00314. Pour définir le type de sanction, il doit être \0033activé\00314 !"; return }
    if {$typepun == ""} { 
      putserv "notice $nick :\00314Tu dois indiquer le type de sanction ! Elles sont :"
      putserv "notice $nick :\00314Pour l'avertissement, mets\0033 1"
      putserv "notice $nick :\00314Pour le dévoice, mets\0033 2"
      putserv "notice $nick :\00314Pour le kick, mets\0033 3"
      putserv "notice $nick :\00314Pour le ban, mets\0033 4"
    }
    if {$typepun == "1"} {
      set appuntype "1"
      putserv "privmsg $chan :\00314Le bot avertira lors d'une pub."
    }
    if {$typepun == "2"} { 
      set appuntype "2"
      putserv "privmsg $chan :\00314Le bot dévoicera pendant \0033 [expr $devtime / 60] minutes\00314 lors d'une pub. Pour changer le temps du dévoice, tapes \0033!ap puntime <Nombre En Secondes>\00314."
    }
    if {$typepun == "3"} {
      set appuntype "3"
      putserv "privmsg $chan :\00314Le bot kickera lors d'une pub."
    }
    if {$typepun == "4"} {
      set appuntype "4"
      putserv "privmsg $chan :\00314Le bot bannira pendant \0033 [expr $bantime / 60] minutes\00314 lors d'une pub. Pour changer le temps du ban, tapes \0033!ap puntime <Nombre En Secondes>\00314."
    }
  }
  if {$qap == "typepun"} {
    if {$appuntype == "1"} { putserv "privmsg $chan :\00314La sanction actuelle est l'\0033Avertissement\00314." }
    if {$appuntype == "2"} { putserv "privmsg $chan :\00314La sanction actuelle est le\0033 Dévoice\00314." }
    if {$appuntype == "3"} { putserv "privmsg $chan :\00314La sanction actuelle est le\0033 Kick\00314." }
    if {$appuntype == "4"} { putserv "privmsg $chan :\00314La sanction actuelle est le\0033 Ban\00314." }
  }
  if {$qap == "timepun"} { 
    if {$appuntype == "1"} { putserv "privmsg $chan :\00314Il n'y a pas de temps pour le type '\0033Avertissement\00314'." }
    if {$appuntype == "2"} { putserv "privmsg $chan :\00314Le temps de dévoice actuel est de\0033 [expr $devtime / 60] minutes\00314." }
    if {$appuntype == "3"} { putserv "privmsg $chan :\00314Il n'y a pas de temps pour le type '\0033Kick\00314'." }
    if {$appuntype == "4"} { putserv "privmsg $chan :\00314Le temps de ban actuel est de\0033 [expr $bantime / 60] minutes\00314." }
  }
}

proc pub:AntiPub {nick uhost hand chan arg} {
  global pubs flags banpub ap devchan banchan devtime bantime appuntype devnick nbdc nbdn file nbk
  set rest [ap:cf $arg]
  foreach pub $pubs {
    if {[isop $nick $chan] || [ishalfop $nick $chan]} { return }
    if {[matchattr $hand $flags $chan] || [matchattr $hand f|f $chan] || $ap == "off"} { return }
    if {[string match -nocase $pub [string tolower $rest]]} {
      if {$appuntype == "1"} {
        putserv "privmsg $chan :\0034Attention \0033$nick\00314, '\0033$pub\00314' est une \0033Pub\00314 fais attention, les pubs sont interdites et les opérateurs (\0034@\00314) peuvent t'expulser s'ils le souhaitent."
        return
      }
      if {$appuntype == "2"} { 
        set devchan $chan
        set devnick $nick
        putquick "mode $chan -v $nick"
        putserv "privmsg $chan :\00314Pub détectée '\0033$pub\00314' Dévoice \0034 [expr $devtime / 60] minutes\00314."
        utimer $devtime [list proc:voice $nick $chan]
        return
      } 
      if {$appuntype == "3"} { 
        set nbk [expr $nbk + 1]
        putserv "kick $chan $nick \00314Pub détectée '\0033$pub\00314'. -\0033 $nbk \00314-"
        set wnum [open $file w]
        puts $wnum $nbk
        close $wnum
        return
      }
      if {$appuntype == "4"} { 
        set banpub "*!*@[lindex [split $uhost @] 1]"
        set banchan $chan
        putquick "mode $chan +b *!*@[lindex [split $uhost @] 1]"
        set nbk [expr $nbk + 1]
        putserv "kick $chan $nick \00314Pub détectée '\0033$pub\00314'. Banni\0034 [expr $bantime / 60] minutes\00314. -\0033 $nbk \00314-"
        set wnum [open $file w]
        puts $wnum $nbk
        close $wnum
        utimer $devtime [list proc:unban $chan *!*@[lindex [split $uhost @] 1]]
        return
      }
    }
  }
}

proc ap:cf str {
  return [stripcodes bcruag $str]
}

proc proc:voice {nick chan} {
  putquick "mode $chan +v $nick"
}

proc proc:unban {chan uhost} {
  putquick "mode $chan -b *!*@[lindex [split $uhost @] 1]"
}