This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

It's possible to modify noversion script ?

Old posts that have not been replied to for several years.
Locked
s
saerd
Voice
Posts: 21
Joined: Wed Feb 11, 2004 12:33 pm

It's possible to modify noversion script ?

Post by saerd »

hi all!!
I need to modify this script (noversion 1.05 tcl found in egghelp.org)

Here the code...

Code: Select all

# noversions.tcl v1.05 [1 August 2000]
# Copyright (C) 1999-2000 Teemu Hjelt <temex@iki.fi>
#
# Latest version can be found from http://www.iki.fi/temex/eggdrop/
# 
# If you have any suggestions, questions or you want to report 
# bugs, please feel free to send me email to temex@iki.fi
#
# This script makes your bot ask ctcp-version from the people  
# who join a channel where the bot is. The bot punishs the 
# user if his/her ctcp-version reply matches one in the list.
#
# Current DCC Commands:
#    .nvcheck <nick|channel>
#
# Tested on eggdrop1.4.4 with TCL 7.6
#
# Version history:
# v1.00 - The very first version!
# v1.01 - Now the bot doesn't ask ctcp-version 
#         from itself when it joins a channel.
#         Also added the nvcheck command.
# v1.02 - Fixed little bug in the nv_punish proc. 
# v1.03 - Fixed few little things.
# v1.04 - Fixed little bug in nv_punish proc.
# v1.05 - Fixed again little bug in the nv_punish proc. User can now be given a
#         warning when (s)he has a matching ctcp-version reply. Should work now
#         also with 1.5.x bots. Changed the name of this script to noversions.tcl

### Settings ###

## Punish the people who have one of the following words in the ctcp-version reply.
set nv_versions {"showdown" "microsoft chat"} 

## Ask ctcp-version if user joins one of these channels.
# Note: Set this to "" to enable punishing on all channels.
set nv_chans "#lamest #botcentral"

## [0/1] If user has a lame IRC-client/script then punish him/her only on $nv_chans?
# Note: If this is set to 0 then the bot punish user on all channels where the bot and the user are.
set nv_onlynvchans 1

## What is the reason for the punishment?
set nv_reason "Lame IRC-client/script"

## [0/1] Kick the user?
set nv_kick 1

## [0/1] Give the user a warning?
set nv_givewarning 1

## Give what kind of warning?
set nv_warning "Don't use lame scripts and/or clients."

## [0/1] Ban the user?
set nv_ban 0

## Ban for how long time (min)?
set nv_bantime 10

## [0/1] Ignore the user?
set nv_ignore 0

## Ignore for how long time (min)?
set nv_ignoretime 10

## What users can use the nvcheck command?
set nv_chkflag "m"

## Don't ask ctcp-version from the users with the following global flags. 
set nv_globflags "m n o b"

## Don't ask ctcp-version from the users with the following channel flags.
set nv_chanflags "m n o"

###### You don't need to edit below this ######

### Misc Things ###

set nv_ver "1.05"

### Bindings ###

bind join - * join:nv_askver
bind ctcr - VERSION ctcr:nv_ctcp
bind notc - * notc:nv_notice
bind dcc $nv_chkflag nvcheck dcc:nvcheck

### Main Procs ###

proc join:nv_askver {nick uhost hand chan} {
global botnick nv_chans nv_globflags nv_chanflags
	if {[string tolower $nick] != [string tolower $botnick]} {
		foreach globflag $nv_globflags { if {[matchattr $hand $globflag]} { return 1 } }
		foreach chanflag $nv_chanflags { if {[matchattr $hand |$chanflag $chan]} { return 1 } }
		if {($nv_chans == "") || ([lsearch -exact [split [string tolower $nv_chans]] [string tolower $chan]] != -1)} {
			putserv "PRIVMSG $nick :\001VERSION\001"
		}
	}
}

proc ctcr:nv_ctcp {nick uhost hand dest key arg} {
global botnick nv_versions nv_globflags nv_chanflags
	if {[string tolower $nick] != [string tolower $botnick]} {
		foreach version $nv_versions {
			if {[string match "*[string tolower $version]*" [string tolower $arg]]} { 
				nv_punish $nick $uhost 
			}
		}
	}
}

proc notc:nv_notice {nick uhost hand text {dest ""}} {
global botnick nv_versions nv_globflags nv_chanflags
if {$dest == ""} { set dest $botnick }
	if {([string tolower $nick] != [string tolower $botnick]) && ([string match "*version*" [lindex [string tolower $text] 0]])} {
		foreach version $nv_versions {
			if {[string match "*[string tolower $version]*" [lrange [string tolower $text] 1 end]]} { 
				nv_punish $nick $uhost 
			}
		}
	}
}

proc dcc:nvcheck {hand idx arg} {
set target [lindex [split $arg] 0]
	putcmdlog "#$hand# nvcheck $arg"
	if {$target == ""} {
		putidx $idx "Usage: .nvcheck <nick|channel>"
	} else {
		putidx $idx "Asking ctcp-version from $target..."
		putserv "PRIVMSG $target :\001VERSION\001"
	}
}

### Other Procs ###

proc nv_punish {nick uhost} {
global botnick nv_chans nv_onlynvchans nv_reason nv_kick nv_givewarning nv_warning nv_ban nv_bantime nv_ignore nv_ignoretime
set hostmask "*!*[string range $uhost [string first "@" $uhost] end]"
set dowhat ""
	if {[string tolower $nick] != [string tolower $botnick]} {
		if {$nv_givewarning} {
			lappend dowhat "giving warning"
			putserv "NOTICE $nick :$nv_warning" 
		}
		if {($nv_ignore) && (![isignore $hostmask])} { 
			lappend dowhat "ignoring"
			newignore $hostmask $botnick $nv_reason $nv_ignoretime 
		}
		foreach chan [channels] {
			if {($nv_onlynvchans) && ([lsearch -exact [split [string tolower $nv_chans]] [string tolower $chan]] == -1)} { continue }
			if {($nv_ban) && (![isban $hostmask $chan]) && ([onchan $nick $chan])} {
				if {![string match "*banning*" $dowhat]} { lappend dowhat "banning" }
				newchanban $chan $hostmask $botnick $nv_reason $nv_bantime 
			}
			if {($nv_kick) && ([botisop $chan]) && ([onchan $nick $chan])} { 
				if {![string match "*kicking*" $dowhat]} { lappend dowhat "kicking" }
				putserv "KICK $chan $nick :$nv_reason" 
			}
		}
		if {$dowhat != ""} {
			set dowhat "-- [join $dowhat " & "]"
		}
		putlog "noversions: $nick ($uhost) is using lame IRC-client/script $dowhat"
	}
}

### End ###

putlog "TCL loaded: noversions.tcl v$nv_ver by Sup <temex@iki.fi>"
I Would that this script do non analyze all user with a nick begin like xxx
so:
xxx-01 xxx-02 ...

it's possible to avoid that this script analyze them ?

THANKS!!!!
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You can check if string matches a certain pattern.
For example:

if {[string match -nocase "*XXX-*" $nick]} { return 0 }

So if the nicks are XXX-?? then the script should be:

Code: Select all

### Settings ###

## Punish the people who have one of the following words in the ctcp-version reply.
set nv_versions {"showdown" "microsoft chat"}

## Ask ctcp-version if user joins one of these channels.
# Note: Set this to "" to enable punishing on all channels.
set nv_chans "#lamest #botcentral"

## [0/1] If user has a lame IRC-client/script then punish him/her only on $nv_chans?
# Note: If this is set to 0 then the bot punish user on all channels where the bot and the user are.
set nv_onlynvchans 1

## What is the reason for the punishment?
set nv_reason "Lame IRC-client/script"

## [0/1] Kick the user?
set nv_kick 1

## [0/1] Give the user a warning?
set nv_givewarning 1

## Give what kind of warning?
set nv_warning "Don't use lame scripts and/or clients."

## [0/1] Ban the user?
set nv_ban 0

## Ban for how long time (min)?
set nv_bantime 10

## [0/1] Ignore the user?
set nv_ignore 0

## Ignore for how long time (min)?
set nv_ignoretime 10

## What users can use the nvcheck command?
set nv_chkflag "m"

## Don't ask ctcp-version from the users with the following global flags.
set nv_globflags "m n o b"

## Don't ask ctcp-version from the users with the following channel flags.
set nv_chanflags "m n o"

###### You don't need to edit below this ######

### Misc Things ###

set nv_ver "1.05"

### Bindings ###

bind join - * join:nv_askver
bind ctcr - VERSION ctcr:nv_ctcp
bind notc - * notc:nv_notice
bind dcc $nv_chkflag nvcheck dcc:nvcheck

### Main Procs ###

proc join:nv_askver {nick uhost hand chan} {
global botnick nv_chans nv_globflags nv_chanflags
   if {[string match -nocase "XXX-??" $nick]} { return 0 }
   if {[string tolower $nick] != [string tolower $botnick]} {
      foreach globflag $nv_globflags { if {[matchattr $hand $globflag]} { return 1 } }
      foreach chanflag $nv_chanflags { if {[matchattr $hand |$chanflag $chan]} { return 1 } }
      if {($nv_chans == "") || ([lsearch -exact [split [string tolower $nv_chans]] [string tolower $chan]] != -1)} {
         putserv "PRIVMSG $nick :\001VERSION\001"
      }
   }
}

proc ctcr:nv_ctcp {nick uhost hand dest key arg} {
global botnick nv_versions nv_globflags nv_chanflags
   if {[string match -nocase "XXX-??" $nick]} { return 0 }
   if {[string tolower $nick] != [string tolower $botnick]} {
      foreach version $nv_versions {
         if {[string match "*[string tolower $version]*" [string tolower $arg]]} {
            nv_punish $nick $uhost
         }
      }
   }
}

proc notc:nv_notice {nick uhost hand text {dest ""}} {
global botnick nv_versions nv_globflags nv_chanflags
   if {$dest == ""} { set dest $botnick }
   if {[string match -nocase "XXX-??" $nick]} { return 0 }
   if {([string tolower $nick] != [string tolower $botnick]) && ([string match "*version*" [lindex [string tolower $text] 0]])} {
      foreach version $nv_versions {
         if {[string match "*[string tolower $version]*" [lrange [string tolower $text] 1 end]]} {
            nv_punish $nick $uhost
         }
      }
   }
}

proc dcc:nvcheck {hand idx arg} {
set target [lindex [split $arg] 0]
   putcmdlog "#$hand# nvcheck $arg"
   if {$target == ""} {
      putidx $idx "Usage: .nvcheck <nick|channel>"
   } else {
      putidx $idx "Asking ctcp-version from $target..."
      putserv "PRIVMSG $target :\001VERSION\001"
   }
}

### Other Procs ###

proc nv_punish {nick uhost} {
global botnick nv_chans nv_onlynvchans nv_reason nv_kick nv_givewarning nv_warning nv_ban nv_bantime nv_ignore nv_ignoretime
set hostmask "*!*[string range $uhost [string first "@" $uhost] end]"
set dowhat ""
   if {[string tolower $nick] != [string tolower $botnick]} {
      if {$nv_givewarning} {
         lappend dowhat "giving warning"
         putserv "NOTICE $nick :$nv_warning"
      }
      if {($nv_ignore) && (![isignore $hostmask])} {
         lappend dowhat "ignoring"
         newignore $hostmask $botnick $nv_reason $nv_ignoretime
      }
      foreach chan [channels] {
         if {($nv_onlynvchans) && ([lsearch -exact [split [string tolower $nv_chans]] [string tolower $chan]] == -1)} { continue }
         if {($nv_ban) && (![isban $hostmask $chan]) && ([onchan $nick $chan])} {
            if {![string match "*banning*" $dowhat]} { lappend dowhat "banning" }
            newchanban $chan $hostmask $botnick $nv_reason $nv_bantime
         }
         if {($nv_kick) && ([botisop $chan]) && ([onchan $nick $chan])} {
            if {![string match "*kicking*" $dowhat]} { lappend dowhat "kicking" }
            putserv "KICK $chan $nick :$nv_reason"
         }
      }
      if {$dowhat != ""} {
         set dowhat "-- [join $dowhat " & "]"
      }
      putlog "noversions: $nick ($uhost) is using lame IRC-client/script $dowhat"
   }
}

### End ###

putlog "TCL loaded: noversions.tcl v$nv_ver by Sup <temex@iki.fi>
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
s
saerd
Voice
Posts: 21
Joined: Wed Feb 11, 2004 12:33 pm

Post by saerd »

Many Thanks!!! it works 100%!!
Thanks to you and this wonderful community!!
CIAO GRAZIE!!!! :D :D :D :D :D :D
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

No problemo! A sinch for me if you'd say. :lol:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked