mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 10:10:25 +00:00
模块化消息扩展、增加简易随机图片
This commit is contained in:
@@ -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("记住了~")
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user