package echo

import (
	"git.lxtend.com/lixiangwuxian/qqbot/constants"
	"git.lxtend.com/lixiangwuxian/qqbot/handler"
	"git.lxtend.com/lixiangwuxian/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,
	}
}
