########################
# ShareTime #
# ------------------- #
# Date: 25-01-2018 #
# Version: v0.6 #
# Author(s): wie #
########################
set sharetime(format) "%A %B %d %Y -- %H:%M:%S"
bind time - "00 * * * *" sharetime
bind pubm - *jam* sharetime_pub
setudef flag sharetime
proc sharetime {nick uhost hand chan arg} {
global sharetime waktu
foreach chan [channels] {
if {[channel get $chan sharetime]} {
replacetime
puthelp "PRIVMSG $chan :$waktu"
}
}
}
proc sharetime_pub {nick uhost hand chan arg} {
global sharetime otime waktu
set rtime [unixtime]
if { $rtime - $otime > 15} {
replacetime
puthelp "PRIVMSG $chan :$waktu"
set otime $rtime
}
}
set otime 0
proc replacetime { } {
global sharetime waktu
set arguments [clock format [clock seconds] -timezone :Asia/Makassar -format $sharetime(format)]
set day [lindex [split $arguments] 0]
if {$day == "Monday"} { set hari "\00312Senin\003" }
if {$day == "Tuesday"} { set hari "\00312Selasa\003" }
if {$day == "Wednesday"} { set hari "\00312Rabu\003" }
if {$day == "Thursday"} { set hari "\00312Kamis\003" }
if {$day == "Friday"} { set hari "\00303Jum'at\003" }
if {$day == "Saturday"} { set hari "\00304Sabtu\003" }
if {$day == "Sunday"} { set hari "\00304Ahad\003" }
set tanggal [lindex [split $arguments] 2]
set month [lindex [split $arguments] 1]
if {$month == "January"} { set bulan "\00312Januari\003" }
if {$month == "February"} { set bulan "\00313Februari\003" }
if {$month == "March"} { set bulan "\00331Maret\003" }
if {$month == "April"} { set bulan "\00303April\003" }
if {$month == "May"} { set bulan "\00320Mei\003" }
if {$month == "June"} { set bulan "\00325Juni\003" }
if {$month == "July"} { set bulan "\00337Juli\003" }
if {$month == "August"} { set bulan "\00304Agustus\003" }
if {$month == "September"} { set bulan "\00309September\003" }
if {$month == "October"} { set bulan "\00310Oktober\003" }
if {$month == "November"} { set bulan "\00322November\003" }
if {$month == "December"} { set bulan "\00304Desember\003" }
set tahun [lindex [split $arguments] 3]
set jam [lindex [split $arguments] 5]
set waktu "Hari $hari, Tanggal64 $tanggal $bulan55 $tahun, Jam12 $jam WITA"
}
putlog "\002SHARETIME:\002 ShareTime.tcl 0.6 by wie is loaded."