mirror of
https://github.com/fumiama/go-onebot-agent.git
synced 2026-06-05 02:00:23 +08:00
feat: add more apis & handle resp
This commit is contained in:
5
perm.go
5
perm.go
@@ -36,6 +36,7 @@ var innerpermtable []byte
|
||||
type PermAction struct {
|
||||
Desc string `yaml:"desc"`
|
||||
Params string `yaml:"params"`
|
||||
Data string `yaml:"data"`
|
||||
}
|
||||
|
||||
// Perm 即 actions.yaml 的 Go struct 映射
|
||||
@@ -51,7 +52,7 @@ func (p *Perm) mdtable(role PermRole) (string, error) {
|
||||
return "", errors.Wrap(ErrNoSuchPermRole, string(role))
|
||||
}
|
||||
table := strings.Builder{}
|
||||
table.WriteString("|功能|action|params|\n|---|---|---|")
|
||||
table.WriteString("|功能|action|params|data|\n|---|---|---|---|")
|
||||
var ac actions
|
||||
if _, ok := p.cache.Load(role); ok {
|
||||
ac = actions{}
|
||||
@@ -71,6 +72,8 @@ func (p *Perm) mdtable(role PermRole) (string, error) {
|
||||
table.WriteByte('|')
|
||||
table.WriteString(a.Params)
|
||||
table.WriteByte('|')
|
||||
table.WriteString(a.Data)
|
||||
table.WriteByte('|')
|
||||
}
|
||||
if ac != nil {
|
||||
p.cache.Store(role, ac)
|
||||
|
||||
Reference in New Issue
Block a user