forked from FloatTech/ZeroBot-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9b84f8
commit 1dfd2c4
Showing
12 changed files
with
290 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//Package chehui莲红cv的防撤回插件,自动转达给主人群内的撤回消息与闪照 | ||
package chehui | ||
|
||
import ( | ||
"strconv" | ||
"strings" | ||
"time" | ||
|
||
ctrl "github.com/FloatTech/zbpctrl" | ||
"github.com/FloatTech/zbputils/control" | ||
zero "github.com/wdvxdr1123/ZeroBot" | ||
"github.com/wdvxdr1123/ZeroBot/message" | ||
) | ||
|
||
func init() { | ||
engine := control.Register("chehui", &ctrl.Options[*zero.Ctx]{ | ||
DisableOnDefault: true, | ||
Help: "自动反闪照、反撤回给bot主人", | ||
}) | ||
engine.OnRegex(`^\[CQ:image.*`, zero.KeywordRule("type=flash")).SetBlock(false). | ||
Handle(func(ctx *zero.Ctx) { | ||
su := zero.BotConfig.SuperUsers[0] | ||
now := time.Unix(ctx.Event.Time, 0).Format("2006-01-02 15:04:05") | ||
raw := ctx.Event.RawMessage | ||
uid := ctx.Event.UserID | ||
gid := ctx.Event.GroupID | ||
username := ctx.CardOrNickName(uid) | ||
groupname := ctx.GetGroupInfo(gid, true).Name | ||
img := strings.ReplaceAll(raw, "type=flash,", "") | ||
text := message.UnescapeCQCodeText("捕捉到了一个闪照!\n" + | ||
"时间:" + now + "\n" + | ||
"来自用户:[" + username + "](" + strconv.FormatInt(uid, 10) + ")\n" + | ||
"来自群聊:[" + groupname + "](" + strconv.FormatInt(gid, 10) + ")\n" + | ||
"以下是原图:\n" + img) | ||
ctx.SendPrivateMessage(su, message.ParseMessageFromString(text)) | ||
}) | ||
engine.On("notice/group_recall").SetBlock(false). | ||
Handle(func(ctx *zero.Ctx) { | ||
su := zero.BotConfig.SuperUsers[0] | ||
now := time.Unix(ctx.Event.Time, 0).Format("2006-01-02 15:04:05") | ||
raw := ctx.GetMessage(message.NewMessageIDFromInteger(ctx.Event.MessageID.(int64))).Elements.String() | ||
uid := ctx.Event.UserID | ||
gid := ctx.Event.GroupID | ||
username := ctx.CardOrNickName(uid) | ||
groupname := ctx.GetGroupInfo(gid, true).Name | ||
text := message.UnescapeCQCodeText("捕捉到了一条撤回的消息!\n" + | ||
"时间:" + now + "\n" + | ||
"来自用户:[" + username + "](" + strconv.FormatInt(uid, 10) + ")\n" + | ||
"来自群聊:[" + groupname + "](" + strconv.FormatInt(gid, 10) + ")\n" + | ||
"以下是源消息:\n" + raw) | ||
ctx.SendPrivateMessage(su, message.ParseMessageFromString(text)) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Package jianbao 每日60秒读懂世界 | ||
package jianbao | ||
|
||
import ( | ||
"github.com/FloatTech/floatbox/web" | ||
ctrl "github.com/FloatTech/zbpctrl" | ||
"github.com/FloatTech/zbputils/control" | ||
zero "github.com/wdvxdr1123/ZeroBot" | ||
"github.com/wdvxdr1123/ZeroBot/message" | ||
) | ||
|
||
func init() { | ||
engine := control.Register("jianbao", &ctrl.Options[*zero.Ctx]{ | ||
DisableOnDefault: false, | ||
Help: "查看每日60秒读懂世界简报\n" + | ||
"- 简报\n", | ||
}) | ||
engine.OnFullMatch("简报").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("http://bh.ayud.top/mrjb") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取简报失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Package tupian 图片获取集合 | ||
package tupian | ||
|
||
import ( | ||
"github.com/FloatTech/floatbox/web" | ||
ctrl "github.com/FloatTech/zbpctrl" | ||
"github.com/FloatTech/zbputils/control" | ||
zero "github.com/wdvxdr1123/ZeroBot" | ||
"github.com/wdvxdr1123/ZeroBot/message" | ||
) | ||
|
||
func init() { | ||
engine := control.Register("tupian", &ctrl.Options[*zero.Ctx]{ | ||
DisableOnDefault: false, | ||
Help: "全部图片指令\n" + | ||
"- 兽耳\n" + | ||
"- 白毛\n" + | ||
"- !原神\n" + | ||
"- 黑丝\n" + | ||
"- 白丝\n" + | ||
"- 随机壁纸\n" + | ||
"- 星空\n" + | ||
"- 涩涩哒咩/我要涩涩\n", | ||
}) | ||
engine.OnFullMatch("兽耳").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("https://iw233.cn/api.php?sort=cat&type") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
engine.OnFullMatch("白丝").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("http://api.iw233.cn/api.php?sort=swbs") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
engine.OnFullMatch("黑丝").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("http://api.iw233.cn/api.php?sort=swhs") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
engine.OnFullMatch("随机壁纸").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("https://iw233.cn/api.php?sort=iw233&type") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
engine.OnFullMatch("白毛").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("https://iw233.cn/api.php?sort=yin&type") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
engine.OnFullMatch("星空").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("https://iw233.cn/api.php?sort=xing&type") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
engine.OnFullMatch("!原神").SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("https://sakura.iw233.cn/Tag/API/web/api/op.php") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
engine.OnFullMatchGroup([]string{"涩涩哒咩", "我要涩涩"}).SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData("http://api.iw233.cn/api.php?sort=st") | ||
if err != nil { | ||
ctx.SendChain(message.Text("获取图片失败惹", err)) | ||
return | ||
} | ||
ctx.SendChain(message.ImageBytes(data)) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Package yiyan 每日一言 | ||
package yiyan | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
ctrl "github.com/FloatTech/zbpctrl" | ||
|
||
"github.com/FloatTech/floatbox/web" | ||
"github.com/FloatTech/zbputils/control" | ||
zero "github.com/wdvxdr1123/ZeroBot" | ||
"github.com/wdvxdr1123/ZeroBot/message" | ||
) | ||
|
||
const url = "https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i" // 动漫 漫画 游戏 文学 影视 诗词 | ||
|
||
type RspData struct { | ||
Id int `json:"id"` | ||
Uuid string `json:"uuid"` | ||
Hitokoto string `json:"hitokoto"` | ||
Type string `json:"type"` | ||
From string `json:"from"` | ||
FromWho string `json:"from_who"` | ||
Creator string `json:"creator"` | ||
CreatorUid int `json:"creator_uid"` | ||
Reviewer int `json:"reviewer"` | ||
CommitFrom string `json:"commit_from"` | ||
CreatedAt string `json:"created_at"` | ||
Length int `json:"length"` | ||
} | ||
|
||
func init() { | ||
engine := control.Register("yiyan", &ctrl.Options[*zero.Ctx]{ | ||
DisableOnDefault: false, | ||
Help: "- 每日一言(建议配合job插件净化群友心灵)\n", | ||
}) | ||
engine.OnFullMatch("每日一言").SetBlock(true).Handle(handle) | ||
} | ||
func handle(ctx *zero.Ctx) { | ||
var rsp RspData | ||
data, err := web.GetData(url) | ||
if err != nil { | ||
ctx.SendChain(message.Text("Err:", err)) | ||
} | ||
json.Unmarshal(data, &rsp) | ||
msg := "" | ||
msg += rsp.Hitokoto + "\n出自:" + rsp.From + "\n" | ||
if len(rsp.FromWho) != 0 { | ||
msg += "作者:" + rsp.FromWho | ||
} | ||
ctx.SendChain(message.Text(msg)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.