/* * private bool IsMod(string talker, string[] Talker_List) * { * for(int i = 0; i < Talker_List.Length; i++) * { * if (Talker_List[i].Replace(" ", "") == talker) * return true; * } * return false; * } * * private void SE12_Thread() * { * while (true) * { * try * { * Thread.Sleep(3600000); * } * catch (Exception) * { * * Thread.Sleep(1500); * if(IsMod()) * SE_Force_Enable = true; * Thread.Sleep(12000); * SE_Force_Enable = false; * } * } * } * * private void SE30_Thread() * { * while (true) * { * try * { * Thread.Sleep(3600000); * } * catch (Exception) * { * SE_Force_Enable = true; * Thread.Sleep(30000); * SE_Force_Enable = false; * } * } * } */ private void SE_pro(string msg) { int _index; if (msg == "") { return; } for (int i = 0; i < SEList.Count; i++) { _index = msg.IndexOf(SEList[i].GetWord()); if (_index != -1) { string _SubStringLeft = msg.Remove(_index).Replace("\n", ""); string _SubStringRight = msg.Remove(0, (_index + SEList[i].GetWord().Length)).Replace("\n", ""); SE_pro(_SubStringLeft); TTS_queue.Enqueue(SEList[i].GetWord()); SE_pro(_SubStringRight); return; } } TTS_queue.Enqueue(msg); }
private void Msg_Reader() { string msg; string talker = null; while (true) { try { Thread.Sleep(3600000); } catch (ThreadInterruptedException) { while (msg_queue.Count != 0) { msg = msg_queue.Dequeue().ToString(); talker = Who_Talk(msg); talker = talker.ToLower(); msg = Room_Content_Proccess(msg); //回傳的msg已經處理成僅剩留言訊息,不包含talker if (CommandSpeech) //如果以指令來說話之功能 啟用 { msg = Speech_Msg_By_command(msg); } msg = Speech_Content_Proccess(msg); //處理多餘的符號 Msg_Command_Proc(talker, msg); if (!msg.StartsWith("!") && !msg.StartsWith("/")) //如果不是指令 { if (Except_Index(talker) == -1) //如果不是Bot { int index = Nick_Name_Index(talker); //判別該留言之人是否具有暱稱 if (index >= 0) //假如有暱稱 { string _NickName; _NickName = TransToNick(index); TTS_queue.Enqueue(_NickName); TTS_queue.Enqueue("說"); } msg = Education_String_Replace(msg); msg = Msg_WordsNumLimit(msg); //====此時的msg已是替換過教育文字並被限制字數後的訊息==== msg = msg.Replace("\n", ""); if (!SE_pause) { SE_pro(msg); //使用recursive之方式 } else { TTS_queue.Enqueue(msg); } TTS_T.Interrupt(); //====自動回應==== Msg_ReAct(talker, msg); if (msg.Contains("やっほー")) //檢查棒讀醬反應 { if (talker != current_channel.ToLower()) { Push_A_message_to_Room(current_channel + " : Ver 1.3.1 やっほー\n"); irc.sendchatMessage("Ver 1.3.1 やっほー"); } } //================ } } //End_ else if(!msg.StartsWith("!")) } //End_ while(msg_queue.Count != 0) } //End_ catch } }