mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
fix nsetu
This commit is contained in:
parent
27d04cbae2
commit
daff47d912
@ -33,10 +33,8 @@ type nsetu struct {
|
|||||||
|
|
||||||
func (n *nsetu) List() (l []string) {
|
func (n *nsetu) List() (l []string) {
|
||||||
if file.IsExist(n.db.DBPath) {
|
if file.IsExist(n.db.DBPath) {
|
||||||
err := n.db.Open(time.Hour * 24)
|
var err error
|
||||||
if err == nil {
|
l, err = n.db.ListTables()
|
||||||
l, err = n.db.ListTables()
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorln("[nsetu]", err)
|
logrus.Errorln("[nsetu]", err)
|
||||||
}
|
}
|
||||||
@ -49,6 +47,10 @@ func (n *nsetu) scanall(path string) error {
|
|||||||
root := os.DirFS(path)
|
root := os.DirFS(path)
|
||||||
_ = n.db.Close()
|
_ = n.db.Close()
|
||||||
_ = os.Remove(n.db.DBPath)
|
_ = os.Remove(n.db.DBPath)
|
||||||
|
err := n.db.Open(time.Hour * 24)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return fs.WalkDir(root, ".", func(path string, d fs.DirEntry, err error) error {
|
return fs.WalkDir(root, ".", func(path string, d fs.DirEntry, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -4,6 +4,7 @@ package nativesetu
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
@ -42,6 +43,10 @@ func init() {
|
|||||||
logrus.Infoln("[nsetu] set setu dir to", setupath)
|
logrus.Infoln("[nsetu] set setu dir to", setupath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
err := ns.db.Open(time.Hour * 24)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
engine.OnRegex(`^本地(.*)$`, fcext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, ns)).SetBlock(true).
|
engine.OnRegex(`^本地(.*)$`, fcext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, ns)).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user