mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
make lint happy
This commit is contained in:
parent
ef081714d7
commit
58e075e6ff
@ -11,7 +11,6 @@ builds:
|
|||||||
- GO111MODULE=on
|
- GO111MODULE=on
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
- darwin
|
|
||||||
goarch:
|
goarch:
|
||||||
- 386
|
- 386
|
||||||
- amd64
|
- amd64
|
||||||
@ -20,11 +19,6 @@ builds:
|
|||||||
goarm:
|
goarm:
|
||||||
- 6
|
- 6
|
||||||
- 7
|
- 7
|
||||||
ignore:
|
|
||||||
- goos: darwin
|
|
||||||
goarch: arm
|
|
||||||
- goos: darwin
|
|
||||||
goarch: 386
|
|
||||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||||
flags:
|
flags:
|
||||||
- -trimpath
|
- -trimpath
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Package cangtoushi 藏头诗
|
||||||
package cangtoushi
|
package cangtoushi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -7,12 +8,10 @@ import (
|
|||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/antchfx/htmlquery"
|
"github.com/antchfx/htmlquery"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
|
|
||||||
@ -29,16 +28,15 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
gCurCookieJar *cookiejar.Jar
|
gCurCookieJar *cookiejar.Jar
|
||||||
engine = control.Register("cangtoushi", &control.Options{
|
csrf string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
engine := control.Register("cangtoushi", &control.Options{
|
||||||
DisableOnDefault: false,
|
DisableOnDefault: false,
|
||||||
Help: "藏头诗\n" +
|
Help: "藏头诗\n" +
|
||||||
"- 藏头诗[xxx]\n- 藏尾诗[xxx]",
|
"- 藏头诗[xxx]\n- 藏尾诗[xxx]",
|
||||||
})
|
})
|
||||||
limit = rate.NewManager(time.Minute, 20)
|
|
||||||
csrf string
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
engine.OnRegex("藏头诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
engine.OnRegex("藏头诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
kw := ctx.State["regex_matched"].([]string)[1]
|
kw := ctx.State["regex_matched"].([]string)[1]
|
||||||
login()
|
login()
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Package juejuezi 绝绝子
|
||||||
package juejuezi
|
package juejuezi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -8,7 +9,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||||
@ -26,29 +26,29 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
engine = control.Register("juejuezi", &control.Options{
|
|
||||||
DisableOnDefault: false,
|
|
||||||
Help: "绝绝子生成器\n" +
|
|
||||||
"- 喝奶茶绝绝子|绝绝子吃饭",
|
|
||||||
})
|
|
||||||
limit = rate.NewManager(time.Minute, 20)
|
limit = rate.NewManager(time.Minute, 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
engine.OnRegex("[\u4E00-\u9FA5]{0,10}绝绝子[\u4E00-\u9FA5]{0,10}").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
control.Register("juejuezi", &control.Options{
|
||||||
|
DisableOnDefault: false,
|
||||||
|
Help: "绝绝子生成器\n" +
|
||||||
|
"- 喝奶茶绝绝子|绝绝子吃饭",
|
||||||
|
}).OnRegex("[\u4E00-\u9FA5]{0,10}绝绝子[\u4E00-\u9FA5]{0,10}").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
toDealStr := []rune(strings.ReplaceAll(ctx.ExtractPlainText(), "绝绝子", ""))
|
toDealStr := []rune(strings.ReplaceAll(ctx.ExtractPlainText(), "绝绝子", ""))
|
||||||
if len(toDealStr) < 2 {
|
switch len(toDealStr) {
|
||||||
|
case 0, 1:
|
||||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("不要只输入绝绝子"))
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("不要只输入绝绝子"))
|
||||||
} else if len(toDealStr) == 2 {
|
case 2:
|
||||||
data, err := juejuezi(string(toDealStr[0]), string(toDealStr[1]))
|
data, err := juejuezi(string(toDealStr[0]), string(toDealStr[1]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text(err))
|
ctx.SendChain(message.Text(err))
|
||||||
}
|
}
|
||||||
ctx.SendChain(message.Text(gjson.Get(helper.BytesToString(data), "text").String()))
|
ctx.SendChain(message.Text(gjson.Get(helper.BytesToString(data), "text").String()))
|
||||||
} else {
|
default:
|
||||||
params := ctx.GetWordSlices(string(toDealStr)).Get("slices").Array()
|
params := ctx.GetWordSlices(string(toDealStr)).Get("slices").Array()
|
||||||
data, err := juejuezi(params[0].String(), params[1].String())
|
data, err := juejuezi(params[0].String(), params[1].String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user