refactor: 重构消息发送模型
This commit is contained in:
32
handler/drawback/drawback.go
Normal file
32
handler/drawback/drawback.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package drawback
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.lxtend.com/qqbot/action"
|
||||
"git.lxtend.com/qqbot/constants"
|
||||
"git.lxtend.com/qqbot/handler"
|
||||
"git.lxtend.com/qqbot/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
handler.RegisterRegexHandler(`撤回`, drawback, constants.LEVEL_USER)
|
||||
}
|
||||
|
||||
func drawback(msg model.Message) model.Reply {
|
||||
msgIdToDrawback, err := model.ParseReplyData(msg.RawMsg)
|
||||
log.Printf("Drawback message %d", msgIdToDrawback.Data.ID)
|
||||
if err != nil {
|
||||
return model.Reply{
|
||||
ReplyMsg: "",
|
||||
ReferOriginMsg: false,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
action.ActionManager.DrawbackMsg(int32(msgIdToDrawback.Data.ID))
|
||||
return model.Reply{
|
||||
ReplyMsg: "",
|
||||
ReferOriginMsg: false,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user