✨ feat(core): 初始化 Bot 命令处理服务器
- 基于 Gin 框架搭建 HTTP 服务,接收并处理 Bot 命令请求 - 实现插件化命令系统,支持通过 Plugin 接口扩展新命令 - 内置菜单、启用/禁用、时间查询等基础命令 - 新增图片生成插件,对接 OpenAI Images API - 支持管理员权限控制、命令动态启禁用 - 提供完整配置管理(.env)与 Docker 部署方案
This commit is contained in:
20
command/admin.go
Normal file
20
command/admin.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"ncatbot-command-server/config"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// IsAdmin 检查用户是否为管理员
|
||||
func IsAdmin(userID string) bool {
|
||||
admins := config.Cfg.AdminUsers
|
||||
if admins == "" {
|
||||
return false
|
||||
}
|
||||
for _, id := range strings.Split(admins, ",") {
|
||||
if strings.TrimSpace(id) == userID {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user