UnderNet.MyForum.ro UnderNet.MyForum.ro
Welcome To UnderNet`s Forum
UnderNet.MyForum.ro
FAQFAQ  SearchSearch  RegisterRegister  ProfileProfile  MemberlistMemberlist  UsergroupsUsergroups  Log in to check your private messagesLog in to check your private messages  Log inLog in 

BadNick.tcl

 
Reply to topic    UnderNet.MyForum.ro Forum Index -> TCL
View previous topic :: View next topic  
Author Message
MeBoy
Comandant
Comandant


Joined: 15 Aug 2007
Posts: 13

PostPosted: 15/08/2007 16:09    Post subject: BadNick.tcl Reply with quote

Code:
######################################################################
#                                                                    #
# Badnick.tcl ---> version 0,1 ( beta )                              #
# Tested on:                                                         #
# Windrop v1.6.17 CYGWIN_NT with Tcl 8.4                             #
# Basic usage guide:                                                 #
#   .chanset #channel +badnick                                       #
#   .badnick -add <word>                                             #
#   .badnick -del <word>                                             #
#   .badnick -check <word>                                           #
#   .badnick -list <word>                                            #
#   .badnick <-add|-del|-check|-list> word                           #
#                                                                    #
# ++ Requests a%a_light or LendingScript ++                          #
#                                                                    #
#                                                                    #
#  LICENSE:                                                          #
#   This code comes with ABSOLUTELY NO WARRANTY.                     #
#                                                                    #
#   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 2 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. (http://www.gnu.org/copyleft/library.txt)               #
#                                                                    #
# Copyright (C) 2007, ReaL|DoG                                       #
# #Lending @ Undernet. Support http://forum.ircproject.info          #
# Badnick at http://script.ircproject.info                           #
#                                                                    #
######################################################################
################## How to Install this script ########################
######################################################################
#                                                                    #
# Create folder /badnick/ in /eggdrop/                               #
# Edit: local_n.tcl, aux.tcl                                         #
#                                                                    #
#                                                                    #
#       +++++++++++++++++++++++++++++++++++                          #
#               Edit Local_n.tcl                                     #
#       +++++++++++++++++++++++++++++++++++                          #
#                                                                    #
# Now, put this lines in local_n.tcl:                                #

a:command -add badnick pub:badnick 0000 000 |n

set bad(file) "badnick/$chan.db"  ;# Here, you can set the folder where the files are going to be saved

proc pub:badnick {hand chan args x mix} {
global settings bad

      set where $chan
   set opt       [lindex $args 0]   ;# Option
   set word          [lindex $args 1]   ;# BadNick word

   switch  -- $opt {

             -add {
             if {![matchattr $hand -|n $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!badnick -add\002 ) then you must be a $chan owner. (+n flag)"; return}
         if {![file exists $bad(file)]} {
                                           set fh [open $bad(file) w]
                                           puts -nonewline $fh ""
                                           close $fh
                                           }
                        set fdz [open $bad(file) r]
         set conte [read $fdz]
         close $fdz
      if {[string match -nocase "*$word*" $conte]} {puthelp "privmsg $chan :This word (\002$word\002) already exists in the $chan bad nick database."; return }


         set fd [open $bad(file) a+]
         puts $fd "$word"
         close $fd
         puthelp "PRIVMSG $chan :Added bad nick \002$word\002 to the $chan database."

      }
      -del {
              if {![matchattr $hand -|n $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!badnick -del\002 ) then you must be a $chan owner. (+n flag)"; return}
         set fd [open $bad(file) r]
         set reads [read $fd]
         close $fd
         set data ""
         if {![string match -nocase "*$word*" $reads]} {puthelp "privmsg $chan :This word (\002$word\002) doesn't exist in the $chan bad nick database."; return }
         if {[llength $reads]} {
            set fd [open $bad(file) w]
                 foreach line [split $reads \n] {
               if {![string match -nocase *$word* $line]} {
                  if {[llength $line]} {puts $fd "$line\n"}
               }
            }
            close $fd
            puthelp "PRIVMSG $chan :I removed the bad nick word \002$word\002 from the $chan database."
         }
      }
           -check {
                        if {![matchattr $hand -|- $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!badnick -check\002 ) then you must be a $chan owner. (+n flag)"; return}
         set fd [open $bad(file) r]
         set cont [read $fd]
         close $fd
      if {![string match -nocase "*$word*" $cont]} {puthelp "privmsg $chan :This word (\002$word\002) doesn't exist in the $chan bad nick database."; return }

         foreach abuse [split $cont \n] {if {[string match -nocase "*$word*" $abuse]} {
                     set a1       [lindex $abuse 0]
            puthelp "PRIVMSG $chan :The word \002$a1\002 exists in the $chan bad nick database."}
         }

      }
           -list {
         if {![matchattr $hand -|N $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!badnick -list\002 ) then you must be a $chan manager (+N flag)"; return}
         set fd [open $bad(file) r]
         set cont [read $fd]
         close $fd
         set listabuse ""
         foreach abuse [split $cont \n] {lappend listabuse "\002[lindex $abuse 0]\002"}
         puthelp "PRIVMSG $chan :I retrieved the following list from the $chan bad nick database: [join $listabuse]"
      }
      default {puthelp "privmsg $chan :Usage: !badnick <-add|-del|-check|-list> word"}
   }
}


############################################################
# Now, go to chanset process, and put there badnick, like here:
# ie:
# [regexp {^[+-](badnick|silent|auto(op|voice)|.....}
# Now save this file and close it.
############################################################
#
#   ++++++++++++++++++++++++++++++++++++                   #
#           Edit aux.tcl                                   #
#   ++++++++++++++++++++++++++++++++++++                   #
# Here put this lines:                                     #

bind join - * check:badnick
proc check:badnick {nick uhost hand chan} {
global settings bad username
   if {![channel get $chan badnick] || ![botisop $chan] || [matchattr $hand +v]} { return 0 }
   set fd [open $bad(file) r]
         set wordlist [read $fd]
         close $fd
                   foreach badnick [string tolower $wordlist] {
                   set bbanmask "*$badnick*!*@*"
      if {[botisop $chan] && ![matchattr $hand -|+v $chan] && [channel get $chan badnick] && [string match *$badnick* [string tolower $nick]]}   {
                   newchanban $chan $bbanmask $username "Before you can join this channel please change your nick because it contains the '\00304$badnick\003' word. Thanks." [channel get $chan ban-time]
          }
     }
}


################################################################
# Now save this file, aux.tcl and edit settings.conf. Here you #
# must to add, setudef flag badnick. After that.. save and type#
# on IRC !rehash or !restart :)                                #
################################################################
Back to top
View user's profile Send private message
Author Message
ironsky2
Junior
Junior


Joined: 01 Jun 2012
Posts: 12
Location: Ukraine

PostPosted: 01/06/2012 15:07    Post subject: Reply with quote

I love your style
Back to top
View user's profile Send private message
Author Message
uahanamiti
Junior
Junior


Joined: 11 Jun 2012
Posts: 13
Location: Ukraine

PostPosted: 19/07/2012 00:14    Post subject: Reply with quote

I will recommend all my friends to read this.
Back to top
View user's profile Send private message
Author Message
uahanamiti
Junior
Junior


Joined: 11 Jun 2012
Posts: 13
Location: Ukraine

PostPosted: 19/07/2012 17:07    Post subject: Reply with quote

You are simply awesome
Back to top
View user's profile Send private message
Author Message
uahanamiti
Junior
Junior


Joined: 11 Jun 2012
Posts: 13
Location: Ukraine

PostPosted: 21/07/2012 09:02    Post subject: Reply with quote

I love how amazing and awesome this is.
Back to top
View user's profile Send private message
Author Message
tabernaculum
Junior 2
Junior 2


Joined: 24 May 2012
Posts: 21
Location: Ukraine

PostPosted: 22/07/2012 07:41    Post subject: Reply with quote

You are so great
Back to top
View user's profile Send private message
Author Message
uahanamiti
Junior
Junior


Joined: 11 Jun 2012
Posts: 13
Location: Ukraine

PostPosted: 23/07/2012 01:55    Post subject: Reply with quote

It's much esiear to understand when you put it that way!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    UnderNet.MyForum.ro Forum Index -> TCL All times are GMT + 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro