Compare commits

...

15 Commits

Author SHA1 Message Date
源文雨
c8072171f0 🔖 1.4.1-beta3 2022-05-25 11:58:32 +08:00
源文雨
485f6d4cef 🐛 job panic 2022-05-25 11:58:01 +08:00
源文雨
2b85097e30 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2022-05-24 10:56:15 +08:00
源文雨
0904789291 🔖 1.4.1-beta2 2022-05-24 10:56:00 +08:00
方柳煜
fda69793a5 修复单身技能会报错问题 (#237) 2022-05-24 10:54:11 +08:00
源文雨
3c22aaf99d 🐛 job panic 2022-05-24 10:52:49 +08:00
MoeMagicMango
151a5d480f Fix: 更换稳定的背景api + 修复因api问题签到结果无法出现但数据库已经记录的问题 (#236)
* 通过修改顺序解决签到背景API出问题

* Update sign_in.go

* 🎨 改进代码样式

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-05-21 22:53:20 +08:00
源文雨
88d136626d update deps 2022-05-20 23:36:46 +08:00
源文雨
170f5bba79 🔖 1.4.1-beta1 2022-05-20 21:15:45 +08:00
源文雨
c4cbb0cd59 添加我问你答 2022-05-20 21:13:49 +08:00
源文雨
0fa04070f1 Update README.md 2022-05-20 15:23:39 +08:00
方柳煜
f8bea241a2 修复小三技能的判断逻辑的缺陷 (#230) 2022-05-16 22:51:54 +08:00
github-actions[bot]
bb6b2e4b29 🎨 改进代码样式 2022-05-16 14:45:37 +00:00
源文雨
557251a679 saucenao 搜图 使用合并转发 2022-05-16 22:44:47 +08:00
github-actions[bot]
696783b0fe 🎨 改进代码样式 2022-05-16 06:42:24 +00:00
7 changed files with 50 additions and 42 deletions

View File

@@ -7,7 +7,7 @@
ZeroBot-Plugin 是 ZeroBot 的 实用插件合集<br><br>
<img src="http://sayuri.fumiama.top/cmoe?name=ZeroBot-Plugin&theme=r34" /><br>
<img src="http://cmoe.azurewebsites.net/cmoe?name=ZeroBot-Plugin&theme=r34" /><br>
[![miraigo](https://img.shields.io/badge/OneBot-MiraiGo-green.svg?style=social&logo=appveyor)](https://github.com/Mrs4s/MiraiGo)
[![oicq](https://img.shields.io/badge/OneBot-OICQ-green.svg?style=social&logo=appveyor)](https://github.com/takayama-lily/oicq)
@@ -318,6 +318,15 @@ print("run[CQ:image,file="+j["img"]+"]")
```
![随机b站404页趣图](https://user-images.githubusercontent.com/41315874/157371451-c09ad3bb-c61a-4a42-9c47-fab3305bc0f8.png)
- [x] [我|大家|有人][说|问][正则表达式]你[答|说|做|执行][模版]
- [x] [查看|看看][我|大家|有人][说|问][正则表达式]
- [x] 删除[大家|有人|我][说|问|让你做|让你执行][正则表达式]
- 注:模版是指含有`$1` `$2`这样的未定参数,会在正则匹配时按顺序填入子匹配对应值
</details>
### *中优先级*

4
go.mod
View File

@@ -3,9 +3,9 @@ module github.com/FloatTech/ZeroBot-Plugin
go 1.18
require (
github.com/FloatTech/AnimeAPI v1.4.1-0.20220512034947-4dd25b414348
github.com/FloatTech/AnimeAPI v1.4.1-0.20220520130802-b8c30f649145
github.com/FloatTech/sqlite v0.2.1
github.com/FloatTech/zbputils v1.4.1-0.20220514105630-80024139bd3c
github.com/FloatTech/zbputils v1.4.1-0.20220525034822-233c3292b457
github.com/antchfx/htmlquery v1.2.4
github.com/corona10/goimagehash v1.0.3
github.com/fogleman/gg v1.3.0

8
go.sum
View File

@@ -1,9 +1,9 @@
github.com/FloatTech/AnimeAPI v1.4.1-0.20220512034947-4dd25b414348 h1:UQRYPg3hXqF/tcqMMcNKPdgOWkjhfNamC1FXi6e1cek=
github.com/FloatTech/AnimeAPI v1.4.1-0.20220512034947-4dd25b414348/go.mod h1:NAGWR4TXLwEVEx0e8yoMj6j5DS0bNWrFcuATozNkT2I=
github.com/FloatTech/AnimeAPI v1.4.1-0.20220520130802-b8c30f649145 h1:COSibysiEmRsI7pICkZMdaX6XM35mlqbtB3f4Tbf6ow=
github.com/FloatTech/AnimeAPI v1.4.1-0.20220520130802-b8c30f649145/go.mod h1:7lhHG03Mqoze1ig/zXnzT3WZGSzdwCl6jk1Eh0f/T9s=
github.com/FloatTech/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8=
github.com/FloatTech/sqlite v0.2.1/go.mod h1:6NfHRzqOo9RWeMJEoAQVuo51Omd5LFNxCNQhMF02/9U=
github.com/FloatTech/zbputils v1.4.1-0.20220514105630-80024139bd3c h1:Vv6Dy4KbTIiDIyk+wTVG/zq5s0z1GItqHX/vkO/WIxc=
github.com/FloatTech/zbputils v1.4.1-0.20220514105630-80024139bd3c/go.mod h1:Cf2wAFtq7OUj4RUHcSQtcAYgAspP06wQseKZwtCJRXQ=
github.com/FloatTech/zbputils v1.4.1-0.20220525034822-233c3292b457 h1:V6O5IqwT2oGAJTDg8WU3C2v7ReULUY3lXaVCd56ABqo=
github.com/FloatTech/zbputils v1.4.1-0.20220525034822-233c3292b457/go.mod h1:Cf2wAFtq7OUj4RUHcSQtcAYgAspP06wQseKZwtCJRXQ=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE=

View File

@@ -10,7 +10,7 @@ import (
var (
info = [...]string{
"* OneBot + ZeroBot + Golang",
"* Version 1.4.0 - 2022-05-16 14:41:17 +0800 CST",
"* Version 1.4.1-beta3 - 2022-05-25 11:58:18 +0800 CST",
"* Copyright © 2020 - 2022 FloatTech. All Rights Reserved.",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}

View File

@@ -26,9 +26,9 @@ type 婚姻登记 struct {
// 结婚证信息
type userinfo struct {
target int64 //对象身份证号
username string //户主名称
targetname string //对象名称
target int64 // 对象身份证号
username string // 户主名称
targetname string // 对象名称
}
//nolint: asciicheck
@@ -37,7 +37,6 @@ func 新登记处() (db 婚姻登记) {
return
}
//nolint: asciicheck
func (db *婚姻登记) 重置() {
db.Lock()
defer db.Unlock()
@@ -46,21 +45,18 @@ func (db *婚姻登记) 重置() {
}
}
//nolint: asciicheck
func (db *婚姻登记) 离婚休妻(gid, wife int64) {
db.Lock()
defer db.Unlock()
delete(db.mp[gid], -wife)
}
//nolint: asciicheck
func (db *婚姻登记) 离婚休夫(gid, husband int64) {
db.Lock()
defer db.Unlock()
delete(db.mp[gid], husband)
}
//nolint: asciicheck
func (db *婚姻登记) 有登记(gid int64) (ok bool) {
db.Lock()
defer db.Unlock()
@@ -74,7 +70,6 @@ func (db *婚姻登记) 有登记(gid int64) (ok bool) {
return
}
//nolint: asciicheck
func (db *婚姻登记) 花名册(ctx *zero.Ctx, gid int64) string {
db.Lock()
defer db.Unlock()
@@ -95,7 +90,6 @@ func (db *婚姻登记) 花名册(ctx *zero.Ctx, gid int64) string {
}))
}
//nolint: asciicheck
func (db *婚姻登记) 查户口(gid, uid int64) (userinfo *userinfo, gender int, ok bool) {
db.Lock()
defer db.Unlock()
@@ -112,7 +106,6 @@ func (db *婚姻登记) 查户口(gid, uid int64) (userinfo *userinfo, gender in
return
}
//nolint: asciicheck
func (db *婚姻登记) 登记(gid, uid, target int64, username, targetname string) {
db.Lock()
defer db.Unlock()
@@ -151,7 +144,7 @@ var (
"今天你向ta表白了ta对你说“你是一个非常好的人”",
"今天你向ta表白了ta给了你一个拥抱后擦肩而过",
},
{ //ntr成功
{ // ntr成功
"你处心积虑的接近tata最终选择跟随你\n",
},
}
@@ -352,22 +345,18 @@ func checkdog(ctx *zero.Ctx) bool {
ctx.SendChain(message.Text("额你的target好像不存在"))
return false
}
uid := ctx.Event.UserID
if uid == fiancee {
ctx.SendChain(message.Text("今日获得成就:自恋狂"))
return false
}
// 获取用户信息
uid := ctx.Event.UserID
uidtarget, uidstatus, ok1 := 民政局.查户口(gid, uid)
_, fianceestatus, ok2 := 民政局.查户口(gid, fiancee)
if !ok1 && !ok2 { // 必须是两个单身
return true
}
if uidtarget.target == fiancee { // 如果本就是一块
ctx.SendChain(message.Text("笨蛋~你们明明已经在一起了啊w"))
return false
}
if ok1 {
if uidtarget.target == fiancee { // 如果本就是一块
ctx.SendChain(message.Text("笨蛋~你们明明已经在一起了啊w"))
return false
}
switch uidstatus {
case 0: // 如果如为攻
ctx.SendChain(message.Text("笨蛋~你家里还有个吃白饭的w"))
@@ -403,8 +392,12 @@ func checkcp(ctx *zero.Ctx) bool {
ctx.SendChain(message.Text("额,你的对象好像不存在?"))
return false
}
// 检查用户是否登记过
uid := ctx.Event.UserID
if fiancee == uid {
ctx.SendChain(message.Text("自我攻略?"))
return false
}
// 检查用户是否登记过
userinfo, uidstatus, ok := 民政局.查户口(gid, uid)
if ok {
if userinfo.target == fiancee { // 如果本就是一块
@@ -414,7 +407,7 @@ func checkcp(ctx *zero.Ctx) bool {
switch uidstatus {
case 0: // 如果如为攻
ctx.SendChain(message.Text("抱歉,建国之后不支持后宫"))
default: //如果为受
default: // 如果为受
ctx.SendChain(message.Text("该是0就是0当0有什么不好"))
}
return false

View File

@@ -94,8 +94,15 @@ func init() { // 插件主体
"直链: ", "https://pixivel.moe/detail?id=", illust.Pid,
)
if imgs != nil {
// 发送搜索结果
ctx.Send(append(imgs, message.Text("\n"), txt))
if zero.OnlyGroup(ctx) {
ctx.SendGroupForwardMessage(ctx.Event.GroupID, message.Message{
ctxext.FakeSenderForwardNode(ctx, txt),
ctxext.FakeSenderForwardNode(ctx, imgs...),
})
} else {
// 发送搜索结果
ctx.Send(append(imgs, message.Text("\n"), txt))
}
} else {
// 图片下载失败,仅发送文字结果
ctx.SendChain(txt)

View File

@@ -24,7 +24,7 @@ import (
)
const (
backgroundURL = "https://iw233.cn/api.php?sort=pc&type=json"
backgroundURL = "https://mirlkoi.ifast3.vipnps.vip/api.php?sort=pc&type=json"
referer = "https://iw233.cn/main.html"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
signinMax = 1
@@ -56,11 +56,10 @@ func init() {
today := now.Format("20060102")
si := sdb.GetSignInByUID(uid)
siUpdateTimeStr := si.UpdatedAt.Format("20060102")
if siUpdateTimeStr != today {
_ = sdb.InsertOrUpdateSignInCountByUID(uid, 0)
}
drawedFile := cachePath + strconv.FormatInt(uid, 10) + today + "signin.png"
picFile := cachePath + strconv.FormatInt(uid, 10) + today + ".png"
if si.Count >= signinMax && siUpdateTimeStr == today {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("今天你已经签到过了!"))
if file.IsExist(drawedFile) {
@@ -68,21 +67,21 @@ func init() {
}
return
}
picFile := cachePath + strconv.FormatInt(uid, 10) + today + ".png"
err := initPic(picFile)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
_ = sdb.InsertOrUpdateSignInCountByUID(uid, si.Count+1)
back, err := gg.LoadImage(picFile)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
if siUpdateTimeStr != today {
_ = sdb.InsertOrUpdateSignInCountByUID(uid, 0)
}
_ = sdb.InsertOrUpdateSignInCountByUID(uid, si.Count+1)
// 避免图片过大,最大 1280*720
back = img.Limit(back, 1280, 720)