Skip to content

Commit

Permalink
QQ权重查询 (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
lianhong2758 committed Nov 16, 2022
1 parent 8d00112 commit 9f37962
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,17 @@ NeteaseCloudMusicApi项目地址:https://binaryify.github.io/NeteaseCloudMusicAp

- [x] 重置花名册

</details>
<details>
<summary>权重查询</summary>

`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan"`

- 来看看大家的账号分吧~据说越高越不容易封号哦

- [x] 权重查询+@xxx

- [x] 权重查询+QQ号(为空时匹配触发者QQ)

</details>
<details>
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan" // QQ权重查询
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎
Expand Down
40 changes: 40 additions & 0 deletions plugin/quan/quan.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Package quan qq权重查询
package quan

import (
"fmt"
"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"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"strconv"
)

const (
quan = "http://tfkapi.top/API/qqqz.php?qq=%v" // api
)

func init() { // 主函数
en := control.Register("quan", &ctrl.Options[*zero.Ctx]{
DisableOnDefault: false,
Brief: "QQ权重查询",
Help: "权重查询方式\n" +
"- 权重查询+@xxx" +
"- 权重查询+QQ号(可以不写,默认本人)",
})
en.OnRegex(`^权重查询\s*(\[CQ:at,qq=)?(\d+)?`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[2] //获取uid
if str == "" { //user
str = strconv.FormatInt(ctx.Event.UserID, 10)
}
es, err := web.GetData(fmt.Sprintf(quan, str)) // 将网站返回结果赋值
if err != nil {
ctx.SendChain(message.Text("出现错误捏:", err))
return
}
ctx.SendChain(message.Text(str, helper.BytesToString(es))) // 输出结果
})

}

0 comments on commit 9f37962

Please sign in to comment.