32 lines
795 B
Go
32 lines
795 B
Go
package drawback
|
|
|
|
import (
|
|
"git.lxtend.com/qqbot/action"
|
|
"git.lxtend.com/qqbot/constants"
|
|
"git.lxtend.com/qqbot/handler"
|
|
"git.lxtend.com/qqbot/message"
|
|
"git.lxtend.com/qqbot/model"
|
|
)
|
|
|
|
func init() {
|
|
handler.RegisterRegexHandler(`撤回`, drawback, constants.LEVEL_USER)
|
|
handler.RegisterHelpInform("撤回", "drawback", "发送 <引用消息>撤回 撤回消息")
|
|
}
|
|
|
|
func drawback(msg model.Message) *model.Reply {
|
|
msgIdToDrawback := message.ReplyMessage{}
|
|
if err := msgIdToDrawback.ParseMessage(msg.RawMsg); 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,
|
|
}
|
|
}
|