public void AddAction(IrcIdentity sender, string message) { LastActions.Enqueue( new ChatAction { Identity = sender, Message = message.ToLowerInvariant(), Time = DateTime.UtcNow, } ); }
private async void ProcessTwitter(ChatMessageEventArgs e) { var matches = TwitterCompiledMatch.Matches(e.Message); foreach (Match match in matches) { var status = match.Groups["status"].Value; if (LastMatches.Contains(e.Recipient + status)) { continue; } LastMatches.Enqueue(e.Recipient + status); var tweet = await TweetAsync.GetTweet(long.Parse(status)); if (tweet?.FullText == null) { continue; } var text = FormatTweet(tweet); var reply = string.Empty; // Checking range because some mentions still display it if (tweet.SafeDisplayTextRange[0] > 0 && tweet.InReplyToScreenName != null) { reply = $" in reply to {Color.BLUE}@{tweet.InReplyToScreenName}{Color.NORMAL}"; } Bootstrap.Client.Client.Message(e.Recipient, $"{Color.OLIVE}» {Color.BLUE}@{tweet.CreatedBy.ScreenName}{Color.LIGHTGRAY} {tweet.CreatedAt.ToRelativeString()}{Color.NORMAL}{reply}: {text}" ); var fakeEvent = new ChatMessageEventArgs(e.Sender, e.Recipient, text); ProcessYoutube(fakeEvent); ProcessTwitch(fakeEvent); } }