the error it gives in partyline
Code: Select all
[16:01:44] Tcl error [pRecogniseCommand]: invalid command name "addhost"
Code: Select all
# recognise.tcl for arfer DALnet channel #atlantis
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- syntax --------------------------------------------------------------------------------------- #
# syntax assuming default command 'recognise'
# /msg <botnick> recognise <password>
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- configuration -------------------------------------------------------------------------------- #
# set here the \msg command to use
set vRecogniseCommand "access"
# set here the password, only a - z, A - Z, 0 - 9 (6 characters minimum)
set vRecognisePassword "PaSSord27"
# set here how long in minutes the bot should recognise you 180 min. = 3 hours
set vRecogniseTime 180
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- code ----------------------------------------------------------------------------------------- #
set vRecogniseVersion 1.0
bind MSG - $vRecogniseCommand pRecogniseCommand
proc pRecogniseCommand {nick uhost hand text} {
global vRecognisePassword
if {[regexp -nocase -- {^[a-z0-9]{6,}$} $vRecognisePassword]} {
set arguments [regsub -all -- {\s{2,}} [stripcodes bcruag [string trim $text]] { }]
if {[llength [split $arguments]] == 1} {
if {[string equal $arguments $vRecognisePassword]} {
if {[onchan $nick]} {
pRecognisePromote $nick $uhost
} else {pRecogniseOutput 001 $nick $hand 0}
} else {pRecogniseOutput 002 $nick $hand $arguments}
} else {pRecogniseOutput 003 $nick $hand 0}
} else {pRecogniseOutput 004 $nick $hand 0}
return 0
}
proc pRecogniseOutput {number nick hand xtra1} {
global vRecogniseCommand vRecogniseTime
switch -- $number {
001 {set output "-error- you must be on a bot channel to use this command"}
002 {set output "-error- password $xtra1 not recognised"}
003 {set output "-error- correct usage /msg <botnick> $vRecogniseCommand <password>"}
004 {set output "-error- incorrectly configured password in script"}
005 {set output "a new userfile record has been temporarily created giving you +n (global owner status). it will be deleted $vRecogniseTime minutes from now"}
006 {set output "the flag +n (global owner status) has been temporarily granted in your userfile record. it will be rescinded $vRecogniseTime minutes from now"}
007 {set output "you are already recognised by the handle $hand as having +n (global owner status)"}
008 {set output "a temporary host $xtra1 has been added to your userfile record giving you +n (global owner status). it will be removed $vRecogniseTime minutes from now"}
default {}
}
putserv "NOTICE $nick :$output"
return 0
}
proc pRecognisePromote {nick uhost} {
global vRecogniseTime
scan $uhost {%[^@]@%s} user host
set user [string trimleft $user ~]
set mask *!*$user@[pRecogniseMaskhost $host]
switch -- [validuser $nick] {
0 {
# nick not in userfile and host not recognised
# create user record with +n
if {[string equal [nick2hand $nick] \*]} {
set hand $nick
adduser $hand
chattr $hand +n
save
pRecogniseOutput 005 $nick $hand 0
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 001]
# nick not in userfile but host recognised
} else {
set hand [nick2hand $nick]
# hand does not have +n flag
# add +n to userfile record
if {![matchattr [nick2hand $nick] n]} {
set flags [chattr $hand]
set hosts [getuser $hand HOSTS]
chattr $hand +n
save
pRecogniseOutput 006 $nick $hand 0
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
# hand already has +n
# do nothing
} else {pRecogniseOutput 007 $nick $hand 0}
}
}
1 {
set hand $nick
set flags [chattr $hand]
set hosts [getuser $hand HOSTS]
# nick in userfile record but host not recognised
# add host and +n if not already there
if {[string equal [nick2hand $nick] \*]} {
addhost $hand $mask
save
if {![matchattr $hand n]} {
chattr $hand +n
save
}
pRecogniseOutput 008 $nick $hand $mask
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
} else {
# nick in userfile and host recognised
# add +n if not already there
if {![matchattr $hand n]} {
chattr $hand +n
save
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
# +n already there
# do nothing
} else {pRecogniseOutput 007 $nick $hand 0}
}
}
default {}
}
return 0
}
proc pRecogniseDemote {nick hand type {flags ""} {hosts ""}} {
switch -- $type {
001 {
# delete the newly created userfile record
deluser $hand
save
}
002 {
# remove all user flags and reinstate only the ones that existed previously
chattr $hand -nmtaoylgvfpqrdkxjcbwzeuh
chattr $hand +$flags
# remove all hosts and reinstate only the ones that existed previously
setuser $hand HOSTS
foreach host $hosts {
addhost $hand $host
}
save
}
default {}
}
return 0
}
proc pRecogniseMaskhost {host} {
switch -- [regexp -- {^([0-9]{1,3}.){3}[0-9]{1,3}$} $host] {
0 {
switch -- [regexp -all -- {\.} $host] {
0 - 1 {set mask $host}
2 - 3 {set mask *.[join [lrange [split $host .] 1 end] .]}
default {set mask *.[join [lrange [split $host .] 2 end] .]}
}
}
1 {set mask [join [lrange [split $host .] 0 end-1] .].*}
default {}
}
return $mask
}
putlog "recognise.tcl for arfer version $vRecogniseVersion loaded"
# eof