/// <summary> /// 運営NGコメントかどうか /// </summary> /// <param name="chat"></param> /// <returns>true: 運営NGコメント</returns> internal static bool IsNg(NicoApi.Chat chat) { // 運営NG IFilteredChat fchat = chat as IFilteredChat; if (fchat != null) { if ((fchat.FilteredReason & Filteringtype.Word) != 0) { return(true); } } return(false); }
public void OnComment(NicoApi.Chat chat) { try { // キーワード検索 string keywordPattern = string.Format("^{0}「(?<keyword>.*?)」{1}$", form.KeywordPrefixMsg, form.KeywordSuffixMsg); //Match kmatch = Regex.Match(chat.Message, @"みっくりさん「(?<keyword>.*?)」ってなに?"); Match kmatch = Regex.Match(chat.Message, keywordPattern); if (kmatch.Success) { INamedChat nchat = chat as INamedChat; if (nchat != null && !string.IsNullOrEmpty(nchat.UserId)) { long timeLeft = kenOpe.ConfirmWebAccess(nchat.UserId, form.WaitTime); if (timeLeft == 0) { string keyword = kmatch.Groups["keyword"].Value; Utility.PostMessage(host, string.Format(">>{0} {1}", chat.No, Utility.InsertBr( kenOpe.GetKeywordSearchMsg(keyword, form.NotFoundMsg, form.SuccessSuffixMsg)))); } else { Utility.PostMessage(host, string.Format(">>{0}番さんが次に検索できるのは、あと{1}秒後です(同一IDでの検索は{2}秒間空けてください)", chat.No, timeLeft, form.WaitTime)); } } return; } } catch (Exception e) { Logger.write(e.Message); MessageBox.Show(e.Message); } }