feat: 添加新股通知
This commit is contained in:
44
handler/newbond/newbond.go
Normal file
44
handler/newbond/newbond.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package newbond
|
||||
|
||||
import (
|
||||
"git.lxtend.com/qqbot/constants"
|
||||
"git.lxtend.com/qqbot/handler"
|
||||
"git.lxtend.com/qqbot/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
handler.RegisterHandler("监听新债", listenBond, constants.LEVEL_USER)
|
||||
handler.RegisterHelpInform("监听新债", "监听新债 开启新债监听")
|
||||
handler.RegisterHandler("取消监听新债", unListenBond, constants.LEVEL_USER)
|
||||
handler.RegisterHelpInform("取消监听新债", "取消监听新债 关闭新债监听")
|
||||
}
|
||||
|
||||
func listenBond(msg model.Message) (reply model.Reply) {
|
||||
if err := AddGroupListen(int(msg.GroupInfo.GroupId)); err != nil {
|
||||
return model.Reply{
|
||||
ReplyMsg: "开启新债监听失败,报错: " + err.Error(),
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
return model.Reply{
|
||||
ReplyMsg: "开启新债监听成功",
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
|
||||
func unListenBond(msg model.Message) (reply model.Reply) {
|
||||
if err := RemoveGroupListen(int(msg.GroupInfo.GroupId)); err != nil {
|
||||
return model.Reply{
|
||||
ReplyMsg: "关闭新债监听失败,报错: " + err.Error(),
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
return model.Reply{
|
||||
ReplyMsg: "关闭新债监听成功",
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user