Exemplo n.º 1
0
        public async Task GiftRoute(object sender, ReceivedDanmakuArgs e)
        {
            // check user eligibility
            if (!Conf.CheckUserEligibility(e))
            {
                return;
            }
            // check gift eligibility
            if (!Conf.CheckGiftEligibility(e))
            {
                return;
            }
            Bridge.ALog("规则检查通过,准备朗读");
            if (Vars.CurrentConf.VoiceReplyFirst)
            {
                var hitAnyRule = await TTSPlayer.PlayVoiceReply(e.Danmaku);

                if (!hitAnyRule || !Vars.CurrentConf.IgnoreIfHitVoiceReply)
                {
                    await TTSPlayer.UnifiedPlay(ProcessGift(e));
                }
            }
            else
            {
                var hitAnyRule = Vars.CurrentConf.VoiceReplyRules.Any(x => x.Matches(e.Danmaku));
                if (!hitAnyRule || !Vars.CurrentConf.IgnoreIfHitVoiceReply)
                {
                    await TTSPlayer.UnifiedPlay(ProcessGift(e));
                }
                await TTSPlayer.PlayVoiceReply(e.Danmaku);
            }
        }
Exemplo n.º 2
0
        public async Task InteractRoute(object sender, ReceivedMessageArgs e)
        {
            // check user eligibility
            if (!Conf.CheckUserEligibility(e))
            {
                return;
            }
            Bridge.ALog("规则检查通过,正在朗读用户交互事件");

            string result;

            switch (e.Message.MsgType)
            {
            case MsgTypeEnum.UserEnter:
                result = ProcessInteract(e.Message, Vars.CurrentConf.OnInteractEnter);
                break;

            case MsgTypeEnum.LiveShare:
                result = ProcessInteract(e.Message, Vars.CurrentConf.OnInteractShare);
                break;

            default: return;
            }

            await TTSPlayer.UnifiedPlay(result);
        }
Exemplo n.º 3
0
 public static async Task WelcomeRoute(object sender, ReceivedDanmakuArgs e)
 {
     // check user eligibility
     if (!Conf.CheckUserEligibility(e))
     {
         return;
     }
     Bridge.ALog("规则检查通过,准备朗读");
     await TTSPlayer.UnifiedPlay(Vars.CurrentConf.OnWelcome
                                 .Replace("$USER", e.Danmaku.UserName)
                                 , true
                                 );
 }
Exemplo n.º 4
0
 public static async Task GuardBuyRoute(object sender, ReceivedDanmakuArgs e)
 {
     // check user eligibility
     if (!Conf.CheckUserEligibility(e))
     {
         return;
     }
     Bridge.ALog("规则检查通过,准备朗读");
     await TTSPlayer.UnifiedPlay(Vars.CurrentConf.OnGuardBuy
                                 .Replace("$COUNT", e.Danmaku.GiftCount.ToString())
                                 .Replace("$USER", e.Danmaku.UserName)
                                 , true
                                 );
 }
Exemplo n.º 5
0
 public async Task SuperChatRoute(object sender, ReceivedDanmakuArgs e)
 {
     // check user eligibility
     if (!Conf.CheckUserEligibility(e))
     {
         return;
     }
     // check content eligibility
     if (!Conf.CheckKeywordEligibility(e))
     {
         return;
     }
     // check length rule
     if (!Conf.CheckDanmakuLength(e))
     {
         return;
     }
     Bridge.ALog("规则检查通过,准备朗读");
     await TTSPlayer.UnifiedPlay(ProcessSuperChat(e), Vars.CurrentConf.SuperChatIgnoreRandomDitch);
 }
Exemplo n.º 6
0
        public async Task InteractRoute(object sender, ReceivedDanmakuArgs e)
        {
            // check user eligibility
            if (!Conf.CheckUserEligibility(e))
            {
                return;
            }
            Bridge.ALog("规则检查通过,正在朗读用户交互事件");

            string result;

            switch (e.Danmaku.InteractType)
            {
            case InteractTypeEnum.Enter:
                result = ProcessInteract(e.Danmaku, Vars.CurrentConf.OnInteractEnter);
                break;

            case InteractTypeEnum.Follow:
                result = ProcessInteract(e.Danmaku, Vars.CurrentConf.OnInteractFollow);
                break;

            case InteractTypeEnum.MutualFollow:
                result = ProcessInteract(e.Danmaku, Vars.CurrentConf.OnInteractMutualFollow);
                break;

            case InteractTypeEnum.Share:
                result = ProcessInteract(e.Danmaku, Vars.CurrentConf.OnInteractShare);
                break;

            case InteractTypeEnum.SpecialFollow:
                result = ProcessInteract(e.Danmaku, Vars.CurrentConf.OnInteractSpecialFollow);
                break;

            default: return;
            }

            await TTSPlayer.UnifiedPlay(result);
        }
Exemplo n.º 7
0
        public async Task CommentRoute(object sender, ReceivedMessageArgs e)
        {
            // check user eligibility
            if (!Conf.CheckUserEligibility(e))
            {
                return;
            }
            // check content eligibility
            if (!Conf.CheckKeywordEligibility(e))
            {
                return;
            }
            // check length rule
            if (!Conf.CheckDanmakuLength(e))
            {
                return;
            }
            Bridge.ALog("规则检查通过,准备朗读");
            if (Vars.CurrentConf.VoiceReplyFirst)
            {
                var hitAnyRule = await TTSPlayer.PlayVoiceReply(e.Message);

                if (!hitAnyRule || !Vars.CurrentConf.IgnoreIfHitVoiceReply)
                {
                    await TTSPlayer.UnifiedPlay(ProcessDanmaku(e));
                }
            }
            else
            {
                var hitAnyRule = Vars.CurrentConf.VoiceReplyRules.Any(x => x.Matches(e.Message));
                if (!hitAnyRule || !Vars.CurrentConf.IgnoreIfHitVoiceReply)
                {
                    await TTSPlayer.UnifiedPlay(ProcessDanmaku(e));
                }
                await TTSPlayer.PlayVoiceReply(e.Message);
            }
        }