package com.yutou.qqbot.models.Commands;

import com.yutou.napcat.handle.QuoteReply;
import com.yutou.napcat.handle.Reply;
import com.yutou.napcat.handle.Text;
import com.yutou.qqbot.Annotations.UseModel;
import com.yutou.qqbot.QQBotManager;
import com.yutou.qqbot.data.MessageChainBuilder;
import com.yutou.qqbot.models.Model;
import com.yutou.qqbot.utlis.AppTools;
import com.yutou.qqbot.utlis.RedisTools;
import com.yutou.napcat.event.MessageEvent;

import static com.yutou.qqbot.models.Model.QQGroupCommands.QQ_TIMEOUT;

@UseModel
public class MaoMaoWorkWaring extends Model {
    @Override
    public boolean isUserPublic() {
        return true;
    }

    @Override
    public String[] getUsePowers() {
        return new String[]{QQ_TIMEOUT};
    }

    @Override
    public String getModelName() {
        return "毛毛工作提醒";
    }

    @Override
    public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
        super.onMessage(qq, event, isGroup);
        if (Integer.parseInt(AppTools.getHours()) >= 6 && event.getSource().getFromId() == 526306604
                && "false".equals(RedisTools.get("maomao_work_" + AppTools.getToDayTime(), "false"))) {
            QQBotManager.getInstance().sendMessage(event.isUser(), qq,
                    new Reply(user),
                    new Text("别水了，快去打工，没钱氪老婆了")
                    );
            RedisTools.set("maomao_work_" + AppTools.getToDayTime(), "true", 20 * 60 * 60);
        }
    }
}
