mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 10:10:25 +00:00
💩👌 make lint happy
This commit is contained in:
@@ -60,7 +60,7 @@ func init() {
|
||||
zero.OnFullMatch("小作文", zero.OnlyToMe).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
ctx.SendChain(message.Text(ARRAY[rand.Intn(len(ARRAY))]))
|
||||
ctx.SendChain(message.Text(array[rand.Intn(len(array))]))
|
||||
})
|
||||
|
||||
// 逆天
|
||||
|
||||
@@ -13,7 +13,7 @@ const (
|
||||
|
||||
var (
|
||||
compo Composition
|
||||
ARRAY []string
|
||||
array []string
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -24,7 +24,7 @@ func init() {
|
||||
panic(err)
|
||||
}
|
||||
loadText()
|
||||
ARRAY = compo.Array
|
||||
array = compo.Array
|
||||
}()
|
||||
}
|
||||
|
||||
@@ -44,18 +44,17 @@ func loadText() {
|
||||
|
||||
func addText(txt string) error {
|
||||
if txt != "" {
|
||||
ARRAY = append(ARRAY, txt)
|
||||
array = append(array, txt)
|
||||
data, err := compo.Marshal()
|
||||
if err == nil {
|
||||
if _, err := os.Stat(datapath); err == nil || os.IsExist(err) {
|
||||
f, err1 := os.OpenFile(pbfile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
|
||||
if err1 != nil {
|
||||
return err1
|
||||
} else {
|
||||
if err1 == nil {
|
||||
defer f.Close()
|
||||
_, err2 := f.Write(data)
|
||||
return err2
|
||||
}
|
||||
return err1
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user