DateToDay.info.dawg0100644000076400010010000000011207506513602014763 0ustar AdministratorNoneInformation: This script shows you the day of the week a date occurs on.DateToDay1.0.tcl0100644000076400010010000001020607506511304014112 0ustar AdministratorNone################################## ### DateToDay.tcl ### ### Version 1.0 ### ### By Wcc ### ### wcc@techmonkeys.org ### ### http://www.dawgtcl.com:81/ ### ### EFnet #|DAWG|Tcl ### ################################## ############################################################################ ### Copyright © 2000 - 2002 |DAWG| Scripting Group. All rights reserved. ### ############################################################################ ################################################################# ## This script shows you the day of the week a date occurs on. ## ################################################################# ############## ## COMMANDS ## ############################################################################## ## DCC ## .day
(Can be changed) ## ######### Shows you the weekday the on which the specified date will occur. ## ############################################################################## ## PUB ## !day
(Can be changed) ## ######### Shows you the weekday the on which the specified date will occur. ## ############################################################################## ########################################################## ## Just load the script, edit the settings, and rehash. ## ########################################################## ############################################################# # Set the flags required to use the script's commands here. # ############################################################# set datetoday_setting(flags) "-|-" ############################# # Set the pub command here. # ############################# set datetoday_setting(p_cmd) "!day" ############################# # Set the dcc command here. # ############################# set datetoday_setting(d_cmd) "day" ################################### # Enable use of bold in dcc chat? # ################################### set datetoday_setting(bold) 1 ############################################# # Prefix "DATETODAY:" in dcc chat messages? # ############################################# set datetoday_setting(DATETODAY:) 1 #################### # Code begins here # #################### if {![string match 1.6.* $version]} { putlog "\002DATETODAY:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.x or later." } if {[info tclversion] < 8.2} { putlog "\002DATETODAY:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." } bind dcc $datetoday_setting(flags) $datetoday_setting(d_cmd) datetoday_dcc bind pub $datetoday_setting(flags) $datetoday_setting(p_cmd) datetoday_pub proc datetoday_dopre {} { if {!$::datetoday_setting(DATETODAY:)} { return "" } if {!$::datetoday_setting(bold)} { return "DATETODAY: " } return "\002DATETODAY:\002 " } proc datetoday_dcc {hand idx text} { if {[string compare $text ""] == 0} { putdcc $idx "[datetoday_dopre]Usage: .$::datetoday_setting(d_cmd)
" ; return } if {![datetoday_valid [set date [lindex [split $text] 0]]]} { putdcc $idx "[datetoday_dopre]The date must be in DD/MM/YY format." ; return } if {[datetoday_invalid $date]} { putdcc $idx "[datetoday_dopre]The date could not be converted." ; return } putdcc $idx "[datetoday_dopre][datetoday_getday $date]" } proc datetoday_pub {nick uhost hand chan text} { if {[string compare $text ""] == 0} { putserv "NOTICE $nick :Usage: .$::datetoday_setting(d_cmd)
" ; return } if {![datetoday_valid [set date [lindex [split $text] 0]]]} { putserv "NOTICE $nick :The date must be in DD/MM/YY format." ; return } if {[datetoday_invalid $date]} { putserv "NOTICE $nick :The date could not be converted." ; return } putserv "PRIVMSG $chan :[datetoday_getday $date]" } proc datetoday_getday {string} { return [clock format [clock scan $string] -format "%A"] } proc datetoday_valid {string} { return [regexp {^[0-9][0-9]/[0-9][0-9]/[0-9][0-9]$} $string] } proc datetoday_invalid {string} { return [catch {clock format [clock scan $string] -format "%A"}] } putlog "\002DATETODAY:\002 DateToDay.tcl Version 1.0 by Wcc is loaded."