34 lines
794 B
Go
34 lines
794 B
Go
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)
|
|
handler.RegisterHelpInform("撤回", "drawback", "发送 <引用消息>撤回 撤回消息")
|
|
}
|
|
|
|
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,
|
|
}
|
|
}
|