-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate.tcl
40 lines (34 loc) · 1001 Bytes
/
date.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# date.tcl
#
# This script shows the current date and time with the !date command.
#
# Usage:
# !date show the current date and time
#
# Enable for a channel with: .chanset #channel +date
# Disable for a channel with: .chanset #channel -date
#
# See https://github.com/hwipl/eggdrop-scripts for the latest version and
# additional information including the license (MIT).
# tested versions, might run on earlier versions
package require Tcl 8.6
package require eggdrop 1.8.4
namespace eval ::date {
# channel flag for enabling/disabling
setudef flag date
}
proc ::date::show_date { nick host hand chan arg } {
# check channel flag if enabled in this channel
if {![channel get $chan date]} {
return 0
}
# get current date
set date_format "%a %b %d %H:%M:%S %Z %Y"
set date [clock format [clock seconds] -format $date_format]
puthelp "PRIVMSG $chan :$date"
return 1
}
namespace eval ::date {
bind pub - !date ::date::show_date
putlog "Loaded date.tcl"
}