我正在尝试设置一个简单的蛋滴机器人来倒计时直到某个事件。我的想法是我给它一个预定的日期和时间,用户输入 !countdown 并且机器人回复“还有 x 天、x 小时、x 分钟直到它发生”。这是我找到的脚本(仅更改为添加事件的 unixtime 日期代替它所具有的),并在我的 eggdrop 机器人上运行它会给出响应,但当然这不是我需要的响应(重要的问题是它完全有效)。
我认为它的作用和我想要它做的事情之间没有很大的区别,但我不知道如何正确修改它。所以我想知道这里是否有人可以告诉我如何做我想做的事情。
bind pub - !test countdown
proc countdown { nickname hostname handle channel arg } {
set date1 "1385798400"
# finds the time and date now
set now [unixtime]
# counts the time passed scince now
incr now -$date1
# shows how long has passed since $date1
set then [duration $now]
puthelp "PRIVMSG $channel :date1 was: $then ago, $nickname | \([\
clock format $date1 -format %d.%m.%Y] @ [\
clock format $date1 -format %H:%M:%S]\)"
}