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.

blackshadow.tcl

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
abah
Halfop
Posts: 89
Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia

blackshadow.tcl

Post by abah »

Hello, I tried using it on a VPS OS centos TCL from BlackShadow but when I wanted to run it I got an error.

Code: Select all

Userinfo TCL v1.08 loaded (URL BF GF IRL EMAIL DOB PHONE ICQ YOUTUBE TWITCH).
use '.help userinfo' for commands.
Tcl error in file 'domain.conf':
invalid command name "#############################################################################"
    while executing
"#############################################################################"
    (file "dwhois/domain.tcl" line 1)
    invoked from within
"source "$eggdrop(root)/domain.tcl""
    (file "dwhois/settings.tcl" line 3)
    invoked from within
"source dwhois/settings.tcl"
    (file "domain.conf" line 224)
* CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
that TCl

Code: Select all

#############################################################################
## CheckDomain.tcl 1.2  (26/11/2021)  			                               ##
##                                                                         ##
##                              Copyright 2008 - 2020 @ WwW.TCLScripts.NET ##
##         _   _   _   _   _   _   _   _   _   _   _   _   _   _           ##
##        / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \          ##
##       ( T | C | L | S | C | R | I | P | T | S | . | N | E | T )         ##
##        \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/          ##
##                                                                         ##
##                       ® BLaCkShaDoW Production ®                        ##
##                                                                         ##
##                                PRESENTS                                 ##
##									                                     								 ® ##
##########################   CHECK DOMAIN TCL   #############################
##									                                    								   ##
##  DESCRIPTION: 							                                             ##
##  Tells you whether an Internet domain name is registered or not.        ##
##    Every valid user can have it's own list of domains that the eggdrop  ##
##    will verify using a timer and announce if something changes to them  ##
##									                                                       ##
##  Tested on Eggdrop v1.8.4 (Debian Linux) Tcl version: 8.6.6             ##
##									                                                       ##
#############################################################################
##								                                                         ##
##  INSTALLATION: 						                                             ##
##  ++ http,tls packages are REQUIRED for this script to work.             ##
##  ++ Edit CheckDomain.tcl script & place it into your /scripts directory.##
##  ++ add "source scripts/CheckDomain.tcl" to your eggdrop.conf & rehash. ##
##								                                                         ##
#############################################################################
##									                                                       ##
##  OFFICIAL LINKS:                                                        ##
##   Bugs report : http://www.tclscripts.net                               ##
##   GitHub page : https://github.com/tclscripts/ 			                   ##
##   Online help : irc://irc.undernet.org/tcl-help                         ##
##                 #TCL-HELP / UnderNet        	                           ##
##                 You can ask in english or romanian                      ##
##									                                                       ##
##     paypal.me/DanielVoipan = Please consider a donation. Thanks!        ##
##									                                                       ##
#############################################################################
##									                                                       ##
##  THE MAGIC MAKERS (TCLscripts.net's team):                              ##
##                                                                         ##
##  o BLaCkShaDoW (Daniel) - coding 'magic' maker & the botsfather.        ##
##    BLaCkShaDoW@tclscripts.net [ www.tclscripts.net ]                    ##
##									                                                       ##
##  o Settore (Stefan) - generous hosting storage & bandwidth for the      ##
##    tclscripts.net project website.                                      ##
##    settore@tclscripts.net [ www.thedeveloper.site ]                     ##
##									                                                       ##
##  o Florian (most craziest imagination guy) - an earful of crazy ideas,  ##
##    the necessary materials needed for our eggdrops to run & tcl scripts ##
##    to be released.                                                      ##
##    florian@tclscripts.net [ www.tntradio.ro ]                           ##
##									                                                       ##
##  o Time2Go (Ionut) - [ #Tcl-Help Admin ] retired..                      ##
##									                                                       ##
##  o zeke - our secret demon "behind the hood".                           ##
##    zeke@tclscripts.net [ www.tclscripts.net ]                           ##
##									                                                       ##
#############################################################################
##									                                                       ##
##           You want a customised TCL Script for your eggdrop?            ##
##               Easy-peasy, just tell us what you need!                   ##
## We can create almost anything in TCL based on your ideas and donations. ##
##    Email blackshadow@tclscripts.net or info@tclscripts.net with your    ##
##     request informations and we'll contact you as soon as possible.     ##
##									                                                       ##
#############################################################################
##								                                         							   ##
##  COMMANDS:                                                              ##
##								                                           							 ##
##  To activate:                                                           ##
##  .chanset +checkdomain | from BlackTools: .set #channel +checkdomain    ##
##                                                                         ##
##  !dom domain - check's the set domain           											   ##
##  !dom save <domain1> <domain2>..	- save domains for timer check         ##
##  !dom reset - reset the domains saved																	 ##
##  !dom status - shows the status of the saved domains                    ##
##  !dom version - shows tcl version                                       ##
##  															                                         ##
##                                                                         ##
#############################################################################
##								                                                         ##
##  PERSONAL AND NON-COMMERCIAL USE LIMITATION.                            ##
##                                                                         ##
##  This program is provided on an "as is" and "as available" basis,       ##
##  with ABSOLUTELY NO WARRANTY. Use it at your own risk.                  ##
##                                                                         ##
##  Use this code for personal and NON-COMMERCIAL purposes ONLY.           ##
##                                                                         ##
##  Unless otherwise specified, YOU SHALL NOT copy, reproduce, sublicense, ##
##  distribute, disclose, create derivatives, in any way ANY PART OF       ##
##  THIS CONTENT, nor sell or offer it for sale.                           ##
##                                                                         ##
##  You will NOT take and/or use any screenshots of this source code for   ##
##  any purpose without the express written consent or knowledge of author.##
##                                                                         ##
##  You may NOT alter or remove any trademark, copyright or other notice   ##
##  from this source code.                                                 ##
##                                                                         ##
##              Copyright 2008 - 2021 @ WwW.TCLScripts.NET                 ##
##                                                                         ##
#############################################################################

#############################################################################
##                              CONFIGURATIONS                             ##
#############################################################################

###
# Cmdchar trigger
# - set here the trigger you want to use.
set infodomain(char) "."

###
#Who can use the !check cmd ? (must have access)
set infodomain(flags) "-|-"

###
#Set private message for when its status changes
set infodomain(prv_message) "--- Domain %domain% changed its status to %status%."

###
#Set website key needed for check
#get free key from https://www.ip2whois.com/
set infodomain(key) "E5A764F1D18F958FAF62616357B7AB8E"

###
# FLOOD PROTECTION
# - set the number of minute(s) to ignore flooders (0 to disable)
###
set infodomain(ignore_prot) "1"

###
#Here is the flood message
set infodomain(flood_text) "Flood protection enabled. You need to wait\002 %get_seconds% seconds\002 before using commands again."

###
# FLOOD PROTECTION
# - set the number of !links before trigger flood protection.
# By default, 3:10, which allows for upto 3 queries in 10 seconds.
# 3 or more quries in 10 seconds would cuase the forth and later
# queries to be ignored for the amount of time specifide above.
###
set infodomain(flood_prot) "3:10"

##############################################################################
###        DO NOT MODIFY HERE UNLESS YOU KNOW WHAT YOU'RE DOING            ###
##############################################################################

package require http
package require tls

###
# Bindings
# + using commands
bind pub $infodomain(flags) $infodomain(char)domain domain_info:check

###
# Channel flags
setudef flag checkdomain

bind time - "00 00 * * *" domain_info:time

###
proc domain_info:time {minute hour day month year} {
	global infodomain
	set users ""
	foreach user [userlist] {
	set domains_saved [getuser $user XTRA check_domains]
if {$domains_saved != ""} {
	lappend users [list $user $domains_saved]
		}
 	}
if {$users != ""} {
	domain_info:timer:timer_act $users 0
	}
}

###
proc domain_info:timer:timer_act {users num} {
	global infodomain
	set user_line [lindex $users $num]
	set user [lindex $user_line 0]
	set domain_info [lindex $user_line 1]
	domain_info:user_auto_check $domain_info $user 0 $num $users
}

###
proc domain_info:user_auto_check {domains user num user_num users} {
	global infodomain
	set domain_line [lindex $domains $num]
	set domain [lindex $domain_line 0]
	set status [lindex $domain_line 1]
	set data [domain_info:data $domain]
	
if {$data == 0} {
	set add_status "NoT ValiD TLD"
	} elseif {$data == -1} {
	set add_status "SiTe Error"
	} else {
	set add_status $data
	}
	set modif [domain_info:modify $domain $user $add_status]
if {$modif == 2} {
if {$add_status == "false"} {
	set add_status "\0034\002Unavailable\002\003"
} elseif {$add_status == "true"} {
	set add_status "\0033\002Available\002\003"
} else {
	set add_status "\0034\002$add_status\002\003"
}
	set nick [hand2nick $user]
	set replace(%domain%) $domain
	set replace(%status%) $add_status
if {$nick != ""} {
	putserv "PRIVMSG $nick :[string map [array get replace] $infodomain(prv_message)]"
		}
}
	set incr [expr $num + 1]
if {[lindex $domains $incr] != ""} {
	utimer 10 [list domain_info:user_auto_check $domains $user $incr $user_num $users]
	} else {
	set incr_user [expr $user_num + 1]
if {[lindex $users $incr_user] != ""} {
	utimer 60 [list domain_info:timer:timer_act $users $incr_user]
		}
	}
}

###
proc domain_info:modify {domain user status} {
	global infodomain
	set found_type 0
	set changed 0
	set list [getuser $user XTRA check_domains]
	set search [lsearch $list "$domain *"]
	set found_dom [lindex $list $search]
	set found_status [lindex $found_dom 1]
if {$found_status != $status} {
	set list [lreplace $list $search $search]
	set to_add [list $domain $status]
	lappend list $to_add
	set found_type 2
	set changed 1
}
if {$found_status == ""} {set found_type 1}
if {$changed == 1} {
	setuser $user XTRA check_domains $list
}
	return $found_type
}

###
proc domain_info:check {nick host hand chan arg} {
	global infodomain
	set dom [lindex [split $arg] 0]
	set save_domains [lrange [split $arg] 1 end]
if {![channel get $chan checkdomain]} {
		return
}
if {$infodomain(ignore_prot) != "0"} {
	set flood_protect [infodomain:flood:prot $chan $host]
	if {$flood_protect == "1"} {
		set get_seconds [infodomain:get:flood_time $host $chan]
		set replace(%get_seconds%) $get_seconds
		putserv "NOTICE $nick :\002$nick\002: [string map [array get replace] $infodomain(flood_text)]"
		return
	}
}
if {[string equal -nocase $dom "version"]} {
	putserv "PRIVMSG $chan :\002$infodomain(projectName) $infodomain(version)\002 coded by\002 $infodomain(author)\002 ($infodomain(email)) --\002 $infodomain(website)\002."
	return
} elseif {[string equal -nocase $dom "save"] && [validuser $hand]} {
if {$save_domains == ""} {
	putserv "NOTICE $nick :\002Error\002: No valid domains supplied."
	return
}
	set valid_d ""
	set invalid_d ""
	set list_d ""
foreach d $save_domains {
if {[regexp {(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]} $d]} {
	lappend valid_d $d
	lappend list_d [list $d ""]
	} else {
	lappend invalid_d $d
	}
}
if {$valid_d == ""} {
	putserv "NOTICE $nick :Valid Domains added : N/A"
} else {
	putserv "NOTICE $nick :Valid Domains added : [join $valid_d ", "]"
	setuser $hand XTRA check_domains $list_d
}
if {$invalid_d != ""} {
	putserv "NOTICE $nick :Invalid Domains: [join $invalid_d ", "]"
	}
	return
} elseif {[string equal -nocase $dom "reset"] && [validuser $hand]} {
	setuser $hand XTRA check_domains
	putserv "NOTICE $nick :CheckDomain reset succeded."
	return
} elseif {[string equal -nocase $dom "status"] && [validuser $hand]} {
	set domains [getuser $hand XTRA check_domains]
if {$domains == ""} {
	putserv "NOTICE $nick :No domains added."
	return
}
		set inc 0
	foreach d $domains {
		incr inc
		set d_name [lindex $d 0]
		set d_status [lindex $d 1]
if {$d_status == ""} {
		set status "\0034\002NoT Verified YeT\002\003"
		} elseif {$d_status == "false"} {
		set status "\0034\002Unavailable\002\003"
		} elseif {$d_status == "true"} {
		set status "\0033\002Available\002\003"
		} else {
		set status "\0034\002Error\002\003"
		}
	lappend d_list "\#$inc. $d_name \($status\)"
	}
	putserv "NOTICE $nick :[join $d_list ", "]"
	return
}
if {![regexp {(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]} $dom]} {
	putserv "PRIVMSG $chan :\002Error\002: Invalid specified domain supplied"
	return
}
	set data [domain_info:data $dom]
if {$data == "0"} {
	putserv "PRIVMSG $chan :\002Error\002: Domain does not have a valid TLD."
	return
} elseif {$data == "-1"} {
putserv "PRIVMSG $chan :\002Error\002: Unable to retrieve information."
return
	}
if {$data == "false"} {
		putserv "PRIVMSG $chan :56\[4Domain Checking56\] 55Domain 94- 60$dom"
		putserv "PRIVMSG $chan :56\[4Domain Checking56\] 58Status 94- 4Already Registered"
				} else {
		putserv "PRIVMSG $chan :56\[4Domain Checking56\] 55Domain 94- 60$dom"
		putserv "PRIVMSG $chan :56\[4Domain Checking56\] 58Status 94- 3Not Registered"
		}
}

###
proc domain_info:data {dom} {
	global infodomain
	set link "https://api.ip2whois.com/v2?key=$infodomain(key)&domain=${dom}"
	set status -1
	http::register https 443 [list ::tls::socket -autoservername true]
	set ipq [http::config -useragent "lynx"]
	set error [catch {set ipq [http::geturl $link -timeout 10000]} eror]
	set data [http::data $ipq]
	::http::cleanup $ipq
if {$error == "0"} {
	regexp -nocase {"error_message":"(.*)"\}} $data -> status
if {[string equal -nocase $status "No data found."]} {return "true"} else {return false}
	} else { return -1 }
}

###
proc infodomain:flood:prot {chan host} {
	global infodomain
	set number [scan $infodomain(flood_prot) %\[^:\]]
	set timer [scan $infodomain(flood_prot) %*\[^:\]:%s]
if {[info exists infodomain(flood:$host:$chan:act)]} {
	return 1
}
foreach tmr [utimers] {
if {[string match "*infodomain:remove:flood $host $chan*" [join [lindex $tmr 1]]]} {
	killutimer [lindex $tmr 2]
	}
}
if {![info exists infodomain(flood:$host:$chan)]} {
	set infodomain(flood:$host:$chan) 0
}
	incr infodomain(flood:$host:$chan)
	utimer $timer [list infodomain:remove:flood $host $chan]
if {$infodomain(flood:$host:$chan) > $number} {
	set infodomain(flood:$host:$chan:act) 1
	utimer [expr $infodomain(ignore_prot) * 60] [list infodomain:expire:flood $host $chan]
	return 1
	} else {
	return 0
	}
}

###
proc infodomain:remove:flood {host chan} {
	global infodomain
if {[info exists infodomain(flood:$host:$chan)]} {
	unset infodomain(flood:$host:$chan)
	}
}

###
proc infodomain:expire:flood {host chan} {
	global infodomain
if {[info exists infodomain(flood:$host:$chan:act)]} {
	unset infodomain(flood:$host:$chan:act)
	}
}

###
proc infodomain:get:flood_time {host chan} {
	global infodomain
		foreach tmr [utimers] {
if {[string match "*infodomain:expire:flood $host $chan*" [join [lindex $tmr 1]]]} {
	return [lindex $tmr 0]
		}
	}
}

###
# Credits
set infodomain(projectName) "CheckDomain"
set infodomain(author) "BLaCkShaDoW"
set infodomain(website) "wWw.TCLScriptS.NeT"
set infodomain(email) "blackshadow\[at\]tclscripts.net"
set infodomain(version) "v1.2"

putlog "\002$infodomain(projectName) $infodomain(version)\002 coded by\002 $infodomain(author)\002 ($infodomain(website)): Loaded & initialised.."

#######################
#######################################################################################################
###                  *** END OF CheckDomain TCL ***                                                 ###
#######################################################################################################
abah - Kota Makassar - Indonesia
User avatar
CrazyCat
Revered One
Posts: 1330
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: blackshadow.tcl

Post by CrazyCat »

The error message is explicit.
Error in domain.conf (not the file you provided) called by dwhois/domain.tcl (not the file you provided)...

Did you well read the documentation of the script and the needed other scripts ?
Post Reply