fix #197: 猜单词出现空指针报警

This commit is contained in:
源文雨 2022-04-18 22:59:33 +08:00
parent f5cef170f0
commit 41c499840f
3 changed files with 7 additions and 4 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.18
require (
github.com/FloatTech/AnimeAPI v1.3.3-0.20220417132103-df55797131af
github.com/FloatTech/sqlite v0.2.1
github.com/FloatTech/zbputils v1.3.3-0.20220418082801-c565913994d3
github.com/FloatTech/zbputils v1.3.3-0.20220418145633-c1d3c00da628
github.com/antchfx/htmlquery v1.2.4
github.com/corona10/goimagehash v1.0.3
github.com/fogleman/gg v1.3.0

4
go.sum
View File

@ -2,8 +2,8 @@ github.com/FloatTech/AnimeAPI v1.3.3-0.20220417132103-df55797131af h1:K7Cdrd1jgi
github.com/FloatTech/AnimeAPI v1.3.3-0.20220417132103-df55797131af/go.mod h1:jUOit4oeiKOtRDy5ZLTJQa7aE0972R/KPF15b22Q3vY=
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.3.3-0.20220418082801-c565913994d3 h1:LqNSUEwgYfGBMfgdJdlCfu6l4rUEX2rKgD0q+64r/bQ=
github.com/FloatTech/zbputils v1.3.3-0.20220418082801-c565913994d3/go.mod h1:K2IVrhwmrVKZSHSHmNoO9JthN1As9RcnQplf+stQ5BY=
github.com/FloatTech/zbputils v1.3.3-0.20220418145633-c1d3c00da628 h1:NC7m06uyenwt4TRyCEkK5lFNId3TB5gKEeOYNQpYTBI=
github.com/FloatTech/zbputils v1.3.3-0.20220418145633-c1d3c00da628/go.mod h1:K2IVrhwmrVKZSHSHmNoO9JthN1As9RcnQplf+stQ5BY=
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

@ -13,6 +13,7 @@ import (
"time"
"github.com/FloatTech/AnimeAPI/tl"
"github.com/sirupsen/logrus"
"github.com/FloatTech/zbputils/binary"
"github.com/FloatTech/zbputils/control"
@ -77,7 +78,7 @@ func init() {
}),
))
en.OnRegex(`(个人|团队)(五阶|六阶|七阶)?猜单词`, zero.OnlyGroup, ctxext.DoOnceOnSuccess(
en.OnRegex(`^(个人|团队)(五阶|六阶|七阶)?猜单词$`, zero.OnlyGroup, ctxext.DoOnceOnSuccess(
func(ctx *zero.Ctx) bool {
var errcnt uint32
var wg sync.WaitGroup
@ -87,6 +88,7 @@ func init() {
go func(i int) {
defer wg.Done()
dc, err := file.GetLazyData(fmt.Sprintf("%scet-4_%d.txt", en.DataFolder(), i), true, true)
logrus.Debugln("[wordle] get", fmt.Sprintf("%scet-4_%d.txt", en.DataFolder(), i))
if err != nil {
atomic.AddUint32(&errcnt, 1)
return
@ -102,6 +104,7 @@ func init() {
go func(i int) {
defer wg.Done()
dd, err := file.GetLazyData(fmt.Sprintf("%sdict_%d.txt", en.DataFolder(), i), true, true)
logrus.Debugln("[wordle] get", fmt.Sprintf("%sdict_%d.txt", en.DataFolder(), i))
if err != nil {
atomic.AddUint32(&errcnt, 1)
return