package wordle

import (
	"git.lxtend.com/lixiangwuxian/qqbot/constants"
	"git.lxtend.com/lixiangwuxian/qqbot/handler"
	"git.lxtend.com/lixiangwuxian/qqbot/model"
)

func init() {
	handler.RegisterHandler("wordle", wordle, constants.LEVEL_USER)
}

func wordle(msg model.Message) (reply *model.Reply) {
	handler.RegisterLiveHandler(msg.GroupInfo.GroupId, msg.UserId, tempTrigger)
	return &model.Reply{
		ReplyMsg:       "",
		ReferOriginMsg: true,
		FromMsg:        msg,
	}
}

func tempTrigger(msg model.Message) (reply *model.Reply, isTrigger bool) {
	handler.UnRegisterLiveHandler(msg.GroupInfo.GroupId, msg.UserId)
	return &model.Reply{
		ReplyMsg:       " ",
		ReferOriginMsg: true,
		FromMsg:        msg,
	}, true
}
