模块化消息扩展、增加简易随机图片

This commit is contained in:
fumiama
2021-06-03 23:46:37 +08:00
parent da44b02b43
commit 6e3f395f07
5 changed files with 59 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ import (
"strconv"
"strings"
"github.com/Yiwen-Chan/ZeroBot-Plugin/msgext"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
@@ -238,9 +239,9 @@ func init() { // 插件主体
if ts.enable {
go timer(ts, func() {
if ts.url == "" {
ctx.SendChain(AtAll(), message.Text(ts.alert))
ctx.SendChain(msgext.AtAll(), message.Text(ts.alert))
} else {
ctx.SendChain(AtAll(), message.Text(ts.alert), ImageNoCache(ts.url))
ctx.SendChain(msgext.AtAll(), message.Text(ts.alert), msgext.ImageNoCache(ts.url))
}
})
ctx.Send("记住了~")

View File

@@ -6,8 +6,6 @@ import (
"strings"
"time"
"unicode"
"github.com/wdvxdr1123/ZeroBot/message"
)
type TimeStamp struct {
@@ -175,24 +173,3 @@ func chineseChar2Int(c rune) int {
return 0
}
}
//@全体成员
func AtAll() message.MessageSegment {
return message.MessageSegment{
Type: "at",
Data: map[string]string{
"qq": "all",
},
}
}
//无缓存发送图片
func ImageNoCache(url string) message.MessageSegment {
return message.MessageSegment{
Type: "image",
Data: map[string]string{
"file": url,
"cache": "0",
},
}
}