1
0
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:
源文雨
2025-09-25 23:02:09 +08:00
parent 0cdc929590
commit 46ace7c2b1
7 changed files with 257 additions and 23 deletions

View File

@@ -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)