qq_bot/handler/echo/echo.go

24 lines
486 B
Go

package echo
import (
"git.lxtend.com/qqbot/constants"
"git.lxtend.com/qqbot/handler"
"git.lxtend.com/qqbot/model"
)
func init() {
handler.RegisterHandler("echo", echo, constants.LEVEL_USER)
handler.RegisterHelpInform("echo", "echo", "echo <message> 再说一遍")
}
func echo(msg model.Message) (reply model.Reply) {
if len(msg.RawMsg) <= 5 {
return model.Reply{}
}
return model.Reply{
ReplyMsg: msg.RawMsg[5:],
ReferOriginMsg: true,
FromMsg: msg,
}
}