forked from FloatTech/ZeroBot-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
548 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ data/SetuTime/cache | |
data/SetuTime/search | ||
data/manager | ||
.idea/ | ||
.DS_Store | ||
.DS_Store | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
/* | ||
暂时只有服务器监控 | ||
*/ | ||
package plugin_ai_false | ||
// Package aifalse 暂时只有服务器监控 | ||
package aifalse | ||
|
||
import ( | ||
"math" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package plugin_bilibili | ||
package bilibili | ||
|
||
import ( | ||
"errors" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/* | ||
Package plugin_chat | ||
Package chat | ||
对话插件 example | ||
*/ | ||
package plugin_chat | ||
package chat | ||
|
||
import ( | ||
"math/rand" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package diana | ||
|
||
import ( | ||
"io" | ||
"os" | ||
"time" | ||
) | ||
|
||
const ( | ||
datapath = "data/Diana" | ||
pbfile = datapath + "/text.pb" | ||
) | ||
|
||
var ( | ||
compo Composition | ||
ARRAY []string | ||
) | ||
|
||
func init() { | ||
go func() { | ||
time.Sleep(time.Second) | ||
err := os.MkdirAll(datapath, 0755) | ||
if err != nil { | ||
panic(err) | ||
} | ||
loadText() | ||
ARRAY = compo.Array | ||
}() | ||
} | ||
|
||
func loadText() { | ||
if _, err := os.Stat(pbfile); err == nil || os.IsExist(err) { | ||
f, err := os.Open(pbfile) | ||
if err == nil { | ||
data, err1 := io.ReadAll(f) | ||
if err1 == nil { | ||
if len(data) > 0 { | ||
compo.Unmarshal(data) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
func addText(txt string) error { | ||
if 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 { | ||
defer f.Close() | ||
_, err2 := f.Write(data) | ||
return err2 | ||
} | ||
} | ||
} | ||
return err | ||
} | ||
return nil | ||
} |
Oops, something went wrong.