go-wxhelper/common/current/robot.go

45 lines
920 B
Go
Raw Normal View History

package current
2023-12-11 10:44:23 +08:00
import (
2024-07-05 09:32:39 +08:00
"go-wechat/model/dto"
"go-wechat/plugin"
2023-12-11 10:44:23 +08:00
)
2023-12-11 10:44:23 +08:00
// robotInfo
// @description: 机器人信息
type robotInfo struct {
2024-07-05 09:32:39 +08:00
info dto.RobotUserInfo
2023-12-11 10:44:23 +08:00
MessageHandler plugin.MessageHandler // 启用的插件
}
// 当前接入的机器人信息
var ri robotInfo
// SetRobotInfo
// @description: 设置机器人信息
// @param info
2024-07-05 09:32:39 +08:00
func SetRobotInfo(info dto.RobotUserInfo) {
2023-12-11 10:44:23 +08:00
ri.info = info
}
// GetRobotInfo
// @description: 获取机器人信息
2024-07-05 09:32:39 +08:00
// @return dto.RobotUserInfo
func GetRobotInfo() dto.RobotUserInfo {
2023-12-11 10:44:23 +08:00
return ri.info
}
// GetRobotMessageHandler
// @description: 获取机器人插件信息
// @return robotInfo
func GetRobotMessageHandler() plugin.MessageHandler {
return ri.MessageHandler
}
// SetRobotMessageHandler
// @description: 设置机器人插件信息
// @param handler
func SetRobotMessageHandler(handler plugin.MessageHandler) {
ri.MessageHandler = handler
}