✏️ 优化 moyu 格式

This commit is contained in:
fumiama 2021-11-23 21:35:42 +08:00
parent 17bb844360
commit 180c32ef50
2 changed files with 4 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package moyu
import (
"fmt"
"strconv"
"time"
)
@ -20,7 +21,7 @@ func NewHoliday(name string, dur, year int, month time.Month, day int) *holiday
func (h *holiday) String() string {
d := time.Until(h.date)
if d >= 0 {
return "距离" + h.name + "还有: " + d.String()
return "距离" + h.name + "还有: " + strconv.FormatFloat(d.Hours()/24.0, 'f', 2, 64) + "天!"
} else if d+h.dur >= 0 {
return "好好享受 " + h.name + " 假期吧!"
} else {

View File

@ -65,8 +65,7 @@ func sendNotice() {
ctx.SendGroupMessage(grp,
[]message.MessageSegment{
message.Text(time.Now().Format("2006-01-02")),
message.Text("上午好,摸鱼人!\n工作再累一定不要忘记摸鱼哦有事没事起身去茶水间去厕所去廊道走走别老在工位上坐着钱是老板的,但命是自己的。"),
message.Text("\n"),
message.Text("上午好,摸鱼人!\n工作再累一定不要忘记摸鱼哦有事没事起身去茶水间去厕所去廊道走走别老在工位上坐着钱是老板的,但命是自己的。\n"),
message.Text(weekend()),
message.Text("\n"),
message.Text(NewHoliday("元旦", 1, 2022, 1, 1)),
@ -83,7 +82,7 @@ func sendNotice() {
message.Text("\n"),
message.Text(NewHoliday("国庆节", 7, 2022, 10, 1)),
message.Text("\n"),
message.Text("\n\n上班是帮老板赚钱,摸鱼是赚老板的钱!最后,祝愿天下所有摸鱼人,都能愉快的渡过每一天…"),
message.Text("上班是帮老板赚钱,摸鱼是赚老板的钱!最后,祝愿天下所有摸鱼人,都能愉快的渡过每一天…"),
},
)
}