mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 02:00:24 +00:00
整理修改
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
package plugin_diana
|
||||
|
||||
import (
|
||||
"github.com/robfig/cron"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
// 开启日报推送
|
||||
func init() {
|
||||
zero.OnFullMatch("/开启粉丝日报", zero.AdminPermission).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
FansDaily(130591566) //群号传进去给下面发信息的函数
|
||||
})
|
||||
}
|
||||
|
||||
// 定时任务每天晚上最后2分钟执行一次
|
||||
func FansDaily(groupID int64) {
|
||||
c := cron.New()
|
||||
c.AddFunc("0 58 23 * * ?", func() { fansData(groupID) })
|
||||
c.Start()
|
||||
}
|
||||
|
||||
// 获取数据拼接消息链并发送
|
||||
func fansData(groupID int64) {
|
||||
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
|
||||
var (
|
||||
diana = fensiapi("672328094")
|
||||
ava = fensiapi("672346917")
|
||||
eileen = fensiapi("672342685")
|
||||
bella = fensiapi("672353429")
|
||||
carol = fensiapi("351609538")
|
||||
)
|
||||
ctx.SendGroupMessage(
|
||||
groupID,
|
||||
message.Text(
|
||||
time.Now().Format("2006-01-02"), " Asoul全团粉丝日报如下", "\n\n",
|
||||
"uid: ", diana.Mid, "\n",
|
||||
"名字: ", diana.Uname, "\n",
|
||||
"当前粉丝数: ", diana.Follower, "\n",
|
||||
"今日涨粉数: ", diana.Rise, "\n",
|
||||
"视频投稿数: ", diana.Video, "\n",
|
||||
"直播间id: ", diana.Roomid, "\n",
|
||||
"舰队: ", diana.GuardNum, "\n",
|
||||
"直播总排名: ", diana.AreaRank, "\n",
|
||||
"数据来源: ", "https://vtbs.moe/detail/", "672328094", "\n\n",
|
||||
|
||||
"uid: ", ava.Mid, "\n",
|
||||
"名字: ", ava.Uname, "\n",
|
||||
"当前粉丝数: ", ava.Follower, "\n",
|
||||
"今日涨粉数: ", ava.Rise, "\n",
|
||||
"视频投稿数: ", ava.Video, "\n",
|
||||
"直播间id: ", ava.Roomid, "\n",
|
||||
"舰队: ", ava.GuardNum, "\n",
|
||||
"直播总排名: ", ava.AreaRank, "\n",
|
||||
"数据来源: ", "https://vtbs.moe/detail/", "672346917", "\n\n",
|
||||
|
||||
"uid: ", eileen.Mid, "\n",
|
||||
"名字: ", eileen.Uname, "\n",
|
||||
"当前粉丝数: ", eileen.Follower, "\n",
|
||||
"今日涨粉数: ", eileen.Rise, "\n",
|
||||
"视频投稿数: ", eileen.Video, "\n",
|
||||
"直播间id: ", eileen.Roomid, "\n",
|
||||
"舰队: ", eileen.GuardNum, "\n",
|
||||
"直播总排名: ", eileen.AreaRank, "\n",
|
||||
"数据来源: ", "https://vtbs.moe/detail/", "672342685", "\n\n",
|
||||
|
||||
"uid: ", bella.Mid, "\n",
|
||||
"名字: ", bella.Uname, "\n",
|
||||
"当前粉丝数: ", bella.Follower, "\n",
|
||||
"今日涨粉数: ", bella.Rise, "\n",
|
||||
"视频投稿数: ", bella.Video, "\n",
|
||||
"直播间id: ", bella.Roomid, "\n",
|
||||
"舰队: ", bella.GuardNum, "\n",
|
||||
"直播总排名: ", bella.AreaRank, "\n",
|
||||
"数据来源: ", "https://vtbs.moe/detail/", "672353429", "\n\n",
|
||||
|
||||
"uid: ", carol.Mid, "\n",
|
||||
"名字: ", carol.Uname, "\n",
|
||||
"当前粉丝数: ", carol.Follower, "\n",
|
||||
"今日涨粉数: ", carol.Rise, "\n",
|
||||
"视频投稿数: ", carol.Video, "\n",
|
||||
"直播间id: ", carol.Roomid, "\n",
|
||||
"舰队: ", carol.GuardNum, "\n",
|
||||
"直播总排名: ", carol.AreaRank, "\n",
|
||||
"数据来源: ", "https://vtbs.moe/detail/", "351609538",
|
||||
))
|
||||
return true
|
||||
})
|
||||
}
|
||||
@@ -6,12 +6,23 @@ import (
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type zhiwang struct {
|
||||
Code int `json:"code"`
|
||||
Data struct {
|
||||
EndTime int `json:"end_time"`
|
||||
Rate float64 `json:"rate"`
|
||||
Related [][]interface{} `json:"related"`
|
||||
StartTime int `json:"start_time"`
|
||||
} `json:"data"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// 小作文查重: 回复要查的消息 查重
|
||||
func init() {
|
||||
@@ -36,21 +47,21 @@ func init() {
|
||||
related := zhiwangjson.Data.Related[0][1].(map[string]interface{})
|
||||
ctx.SendChain(message.Text(
|
||||
"枝网文本复制检测报告(简洁)", "\n",
|
||||
"查重时间: ", timecurrent(), "\n",
|
||||
"总文字复制比: ", math.Floor(zhiwangjson.Data.Rate * 100), "%", "\n",
|
||||
"查重时间: ", time.Now().Format("2006-01-02 15:04:05"), "\n",
|
||||
"总文字复制比: ", math.Floor(zhiwangjson.Data.Rate*100), "%", "\n",
|
||||
"相似小作文:", "\n",
|
||||
related["content"].(string)[:102] + ".....", "\n",
|
||||
related["content"].(string)[:102]+".....", "\n",
|
||||
"获赞数", related["like_num"], "\n",
|
||||
zhiwangjson.Data.Related[0][2].(string), "\n",
|
||||
"作者: ", related["m_name"], "\n",
|
||||
"发表时间: ", timestamp(related["ctime"].(float64)), "\n",
|
||||
"发表时间: ", time.Unix(int64(related["ctime"].(float64)), 0).Format("2006-01-02 15:04:05"), "\n",
|
||||
"查重结果仅作参考,请注意辨别是否为原创", "\n",
|
||||
"数据来源: https://asoulcnki.asia/",
|
||||
))
|
||||
}else {
|
||||
))
|
||||
} else {
|
||||
return
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 发起api请求并把返回body交由json库解析
|
||||
@@ -65,7 +76,7 @@ func zhiwangapi(Text string) *zhiwang {
|
||||
client := &http.Client{}
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil{
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
@@ -95,4 +106,4 @@ func FullMatchText(src ...string) zero.Rule {
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user