mirror of
https://github.com/fumiama/go-onebot-agent.git
synced 2026-06-12 14:10:25 +08:00
feat: add memory
This commit is contained in:
16
types.go
16
types.go
@@ -64,3 +64,19 @@ type Terminus struct{}
|
||||
func (Terminus) String() string {
|
||||
return `{"action":"` + EOA + `"}`
|
||||
}
|
||||
|
||||
type Memory struct {
|
||||
Action string `json:"action"`
|
||||
GroupID int64 `json:"group_id,omitempty"` // QQ群号
|
||||
UserID int64 `json:"user_id,omitempty"` // QQ号
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
func (m *Memory) String() string {
|
||||
sb := strings.Builder{}
|
||||
err := json.NewEncoder(&sb).Encode(m)
|
||||
if err != nil {
|
||||
panic(errors.Wrap(err, "unexpected"))
|
||||
}
|
||||
return strings.TrimSpace(sb.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user