########################
# ShareTime #
# ------------------- #
# Date: 25-01-2018 #
# Version: v0.6 #
# Author(s): wie #
########################
set sharetime(format) "%A %B %d %Y -- %H:%M:%S"
bind cron - "*/15 * * * *" sharetime
bind pubm - *saat* sharetime_pub
setudef flag sharetime
proc sharetime {min hour day month dow} {
global chan sharetime
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 :Europe/Istanbul -format $sharetime(format)]
set day [lindex [split $arguments] 0]
if {$day == "Monday"} { set hari "\00312Pazartesi\003" }
if {$day == "Tuesday"} { set hari "\00312SaLı\003" }
if {$day == "Wednesday"} { set hari "\00312Çarşamba\003" }
if {$day == "Thursday"} { set hari "\00312Perşembe\003" }
if {$day == "Friday"} { set hari "\00303Cuma\003" }
if {$day == "Saturday"} { set hari "\00304Cumartesi\003" }
if {$day == "Sunday"} { set hari "\00304Pazar\003" }
set tanggal [lindex [split $arguments] 2]
set month [lindex [split $arguments] 1]
if {$month == "January"} { set bulan "\00312Ocak\003" }
if {$month == "February"} { set bulan "\00313Şubat\003" }
if {$month == "March"} { set bulan "\00331Mart\003" }
if {$month == "April"} { set bulan "\00303Nisan\003" }
if {$month == "May"} { set bulan "\00320Mayıs\003" }
if {$month == "June"} { set bulan "\00325Haziran\003" }
if {$month == "July"} { set bulan "\00337Temmuz\003" }
if {$month == "August"} { set bulan "\00304Ağustos\003" }
if {$month == "September"} { set bulan "\00309Eylül\003" }
if {$month == "October"} { set bulan "\00310Ekim\003" }
if {$month == "November"} { set bulan "\00322Kasım\003" }
if {$month == "December"} { set bulan "\00304Aralık\003" }
set tahun [lindex [split $arguments] 3]
set jam [lindex [split $arguments] 5]
set waktu "Su anda Saat $jam Günlerden $hari, $bulan $tahun"
}
putlog "zaman.tcl"