- 基于 Gin 框架搭建 HTTP 服务,接收并处理 Bot 命令请求 - 实现插件化命令系统,支持通过 Plugin 接口扩展新命令 - 内置菜单、启用/禁用、时间查询等基础命令 - 新增图片生成插件,对接 OpenAI Images API - 支持管理员权限控制、命令动态启禁用 - 提供完整配置管理(.env)与 Docker 部署方案
36 lines
806 B
Go
36 lines
806 B
Go
package command
|
|
|
|
// Req 请求结构体
|
|
type Req struct {
|
|
Command string `json:"command"`
|
|
Content string `json:"content"`
|
|
RawMessage string `json:"raw_message"`
|
|
UserID string `json:"user_id"`
|
|
GroupID string `json:"group_id"`
|
|
MessageID string `json:"message_id"`
|
|
}
|
|
|
|
// Resp 响应结构体
|
|
type Resp struct {
|
|
Reply string `json:"reply,omitempty"`
|
|
Messages []Message `json:"messages,omitempty"`
|
|
UserID string `json:"user_id,omitempty"`
|
|
}
|
|
|
|
// Message 消息结构体
|
|
type Message struct {
|
|
Type MsgType `json:"type"`
|
|
Msg string `json:"msg,omitempty"`
|
|
URL string `json:"url,omitempty"`
|
|
}
|
|
|
|
// MsgType 消息类型
|
|
type MsgType string
|
|
|
|
const (
|
|
MsgTypeText MsgType = "text"
|
|
MsgTypeImage MsgType = "image"
|
|
MsgTypeFile MsgType = "file"
|
|
MsgTypeVideo MsgType = "video"
|
|
)
|