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 PaoPaoSleepWaring 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())>=22 && event.getSource().getFromId() == 914520754
                && "false".equals(RedisTools.get("paopao_sleep_"+AppTools.getToDayTime(),"false"))){
           // builder.append(new QuoteReply(event.getMessage().getId()));
            QQBotManager.getInstance().sendMessage(event.isUser(),qq,
                    new Reply(user),
                    new Text("别水了，该睡了～")
                    );
            RedisTools.set("paopao_sleep_"+AppTools.getToDayTime(),"true",1*60*60);
        }
        /*if(event.getSource().getFromId() == 914520754 && msg.contains("#体力")){
            MessageChainBuilder builder=new MessageChainBuilder();
            builder.append(new At(369224573L));
            builder.append("惠城! 体力! ");
            QQBotManager.getInstance().sendMessage(qq,builder);
        }*/
    }
}
