Skip to content

Commit 9f37962

Browse files
authored
QQ权重查询 (#500)
1 parent 8d00112 commit 9f37962

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,17 @@ NeteaseCloudMusicApi项目地址:https://binaryify.github.io/NeteaseCloudMusicAp
10671067

10681068
- [x] 重置花名册
10691069

1070+
</details>
1071+
<details>
1072+
<summary>权重查询</summary>
1073+
1074+
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan"`
1075+
1076+
- 来看看大家的账号分吧~据说越高越不容易封号哦
1077+
1078+
- [x] 权重查询+@xxx
1079+
1080+
- [x] 权重查询+QQ号(为空时匹配触发者QQ)
10701081

10711082
</details>
10721083
<details>

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ import (
114114
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别
115115
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签
116116
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆
117+
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan" // QQ权重查询
117118
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙
118119
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术
119120
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎

plugin/quan/quan.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Package quan qq权重查询
2+
package quan
3+
4+
import (
5+
"fmt"
6+
"github.com/FloatTech/floatbox/web"
7+
ctrl "github.com/FloatTech/zbpctrl"
8+
"github.com/FloatTech/zbputils/control"
9+
zero "github.com/wdvxdr1123/ZeroBot"
10+
"github.com/wdvxdr1123/ZeroBot/message"
11+
"github.com/wdvxdr1123/ZeroBot/utils/helper"
12+
"strconv"
13+
)
14+
15+
const (
16+
quan = "http://tfkapi.top/API/qqqz.php?qq=%v" // api
17+
)
18+
19+
func init() { // 主函数
20+
en := control.Register("quan", &ctrl.Options[*zero.Ctx]{
21+
DisableOnDefault: false,
22+
Brief: "QQ权重查询",
23+
Help: "权重查询方式\n" +
24+
"- 权重查询+@xxx" +
25+
"- 权重查询+QQ号(可以不写,默认本人)",
26+
})
27+
en.OnRegex(`^权重查询\s*(\[CQ:at,qq=)?(\d+)?`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
28+
str := ctx.State["regex_matched"].([]string)[2] //获取uid
29+
if str == "" { //user
30+
str = strconv.FormatInt(ctx.Event.UserID, 10)
31+
}
32+
es, err := web.GetData(fmt.Sprintf(quan, str)) // 将网站返回结果赋值
33+
if err != nil {
34+
ctx.SendChain(message.Text("出现错误捏:", err))
35+
return
36+
}
37+
ctx.SendChain(message.Text(str, helper.BytesToString(es))) // 输出结果
38+
})
39+
40+
}

0 commit comments

Comments
 (0)