DoctorD90 icon

Ignore.tcl 2.5.1

DoctorD90 | PRO | 05/07/13 08:50:40 PM UTC | 0 ⭐ | 6146 👁️ | Never ⏰ | []
TCL |

6.84 KB

|

None

|

0 👍

/

0 👎

### Ignore.tcl 2.5.1 kPnKk1Zs
 
#REQUIREMENTS
# nOwn.tcl dr7v2Zmq
 
#SUGGESTED
# PBinSrc.tcl fMrtKqyq
# TCLLoader.tcl smApj15u
 
#LICENSE
# Copyright © 2013 Alberto Dietze "DoctorD90"
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
 
#PATERNITY
#Coder: DoctorD90
#Network: irc.OnlineGamesNet.net
#Chan: #eHito
#Mail: [email protected]
#Script's List: www.EggTcl.tk
 
#PURPOSE
#Ignore people and prevent that can use bot's commands.
 
#USAGE
#Use commands that you set in SETTINGS section.
#Add: <Nick|Mask> <Reason>
#TimeAdd: <Minutes> <Nick|Mask> <Reason>
#Del: <Ignore Entry's Number>
 
#SETTINGS
#Set the time in minutes that temporary ignores should last.
#By default, is used the default value setted
#in your eggdrop's config file.
#If you want change it, change this sett.
set ignore(exp) ${ignore-time}
#Set flag of people can use public command.
set ignore(pflag) "n"
#Set flag of people can use query command.
set ignore(qflag) "n"
#Set public command to add ignore.
set ignore(padd) ".+ignore"
#Set query command to add ignore.
set ignore(qadd) ".+ignore"
#Set public command to add time ignore.
set ignore(ptadd) ".+tignore"
#Set query command to add time ignore.
set ignore(qtadd) ".+tignore"
#Set public command to list ignores.
set ignore(psee) ".ignore"
#Set query command to list ignores.
set ignore(qsee) ".ignore"
#Set public command to del ignore.
set ignore(pdel) ".-ignore"
#Set query command to del ignore.
set ignore(qdel) ".-ignore"
#Set public command to del ignore.
set ignore(padel) ".-ignoreall"
#Set query command to del ignore.
set ignore(qadel) ".-ignoreall"
 
 
### DON'T EDIT ANYTHING BELOW ###
 
set trigger-on-ignore 0
 
### Ignore
 
bind pub $ignore(pflag) $ignore(padd) pub_ignoreadd
proc pub_ignoreadd {nick uhost hand chan text} {
  msg_tignoreadd $nick $uhost $hand "${::ignore-time} $text"
}
 
bind msg $ignore(qflag) $ignore(qadd) msg_ignoreadd
proc msg_ignoreadd {nick uhost hand text} { 
  msg_tignoreadd $nick $uhost $hand "${::ignore-time} $text"
}
 
bind pub $ignore(pflag) $ignore(ptadd) pub_tignoreadd
proc pub_tignoreadd {nick uhost hand chan text} {
  msg_tignoreadd $nick $uhost $hand $text
}
 
bind msg $ignore(qflag) $ignore(qtadd) msg_tignoreadd
proc msg_tignoreadd {nick uhost hand text} {
  set text [split $text]
  set time [lindex $text 0]
  set target [lindex $text 1]
  set why [join [lrange $text 2 end]]
  ignore_add $nick $target $why $time
}
 
proc ignore_add {nick target why exp} {
  if {![string is integer -strict $exp]} {
    notice $nick "\002AddIgnore:\002 Expiration Ignore In Number Format Required ."
    return
  }
  if {$exp < "0"} {
    set exp "0"
  }
  if {![string length [string trim $target]]} {
    notice $nick "\002AddIgnore:\002 User's Nick|Mask Required."
    return
  }
  if {[regexp -nocase -- {([^\s]+![^\s]+@[^\s]+)} $target mask]} {
    if {$mask == "*!*@*"} {
      notice $nick "SecuritySystem: Ignore Mask not allowed."
      return
    }
  } else {
    if {![onchan $target]} {
      notice $nick "\002$target\002 aint on no one chan in which I am too or Ignore Mask not valid."
      return
    }
    set mask [maskhost ${target}![getchanhost $target] 2]
  }
  if {[isignore $mask]} {
    notice $nick "\002$mask\002 yet Ignored."
    return
  }
  set Bmask "$::botnick![getchanhost $::botnick]"
  if {[lsearch -nocase $Bmask $mask] != "-1"} {
    notice $nick "Dumbass. I aint ignorin' myself!"
    return
  }
  set Nmask [getuser $::owner HOSTS]
  lappend Nmask "[nown]![getchanhost [nown]]"
  if {[lsearch -nocase $Nmask $mask] != "-1"} {
    notice $nick "Dumbass. I aint ignorin' my owner!" 
    return
  }
  if {![string length [string trim $why]]} {
    set why "None"
  }
  newignore $mask $nick $why $exp
  notice $nick "\002$mask\002 has been ignored for \002$why\002"
}
 
 
### UnIgnore
 
bind pub $ignore(pflag) $ignore(pdel) pub_ignoredel
proc pub_ignoredel {nick uhost hand chan text} {
  msg_ignoredel $nick $uhost $hand $text
}
 
bind msg $ignore(qflag) $ignore(qdel) msg_ignoredel
proc msg_ignoredel {nick uhost hand text} {
  if {[iliste $nick]} {return}
  if {![string length [string trim $text]]} {
    notice $nick "\002DelIgnore:\002 Ignore's Number Required."
    return
  }
  set i [lindex [split $text] 0]
  set l [llength [ignorelist]]
  if {![string is integer -strict $i] || $i < "0" || $i >= $l} {
    notice $nick "\002DelIgnore:\002 Ignore's Number Not Accepted."
    return
  }
  set mask [lindex [lindex [ignorelist] $i] 0]
  killignore $mask
  notice $nick "\002$mask\002 UnIgnored"
}
 
 
### UnIgnoreAll
 
bind pub $ignore(pflag) $ignore(padel) pub_unignoreall
proc pub_unignoreall {nick uhost hand chan text} {
  msg_unignoreall $nick $uhost $hand $text
}
 
bind msg $ignore(qflag) $ignore(qadel) msg_unignoreall
proc msg_unignoreall {nick uhost hand text} {
  if {[iliste $nick]} {return}
  set l [llength [ignorelist]]
  set i 0
  foreach ignore [ignorelist] {
    set mask [lindex $ignore 0]
    killignore $mask
    notice $nick "\002$mask\002 UnIgnored"
    incr i
  }
  if {$i > 1} {
    set ixs s
  } else { 
    set ixs ""
  }
  notice $nick "Removed \002$i\002/\002$l\002 ignore$ixs from Ignore List"
}
 
 
### IgnoreList
 
bind pub $ignore(pflag) $ignore(psee) pub_ignore
proc pub_ignore {nick uhost hand chan text} {
  msg_ignore $nick $uhost $hand $text
}
 
bind msg $ignore(qflag) $ignore(qsee) msg_ignore
proc msg_ignore {nick uhost hand text} {
  if {[iliste $nick]} {return}
  notice $nick "'s  Ignore List"
  set i 0
  foreach ignore [ignorelist] {
    foreach {mask why expt sett who} $ignore { break }
    set Start [ clock format $sett -format "%d/%m/%Y %H:%M:%S" ]
    set End [ clock format $expt -format "%d/%m/%Y %H:%M:%S" ]
    if {$Start > $End} {
      set End NEVER
    }
    notice $nick "\002$i\002) \002$mask (\037From\037: \002$Start\002 - \037Since\037: \002$End\002; \037By\037: \002$who\002; \037Reson\037: \002$why\002)\002"
    incr i
  }
  notice $nick "'s  Ignore List  \002\037*Completed*\037\002"
}
 
proc iliste {who} {
  set r 0
  if {![llength [ignorelist]]} {
    notice $who "'s  Ignore List  \002\037*EMPTY*\037\002"
    set r 1
  }
  return $r
}
 
###
putlog "Ignore.tcl LOADED"

Comments