Skip to content

Commit

Permalink
Merge pull request #598 from TheTrackerCouncil/dr-dubz-art-alert
Browse files Browse the repository at this point in the history
Say something when Dr_Dubz posts art
  • Loading branch information
Vivelin authored Nov 10, 2024
2 parents bf793c5 + 69566da commit 78aea17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,9 @@ public class ChatConfig : IMergeable<ChatConfig>
/// Gets the phrases for when the poll was terminated before any results came in
/// </summary>
public SchrodingersString? PollErrorTerminated { get; init; }

/// <summary>
/// Gets the phrases to say when Dr_Dubz posts an art link in the chat.
/// </summary>
public SchrodingersString? DrDubzArtPosted { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ private void ChatClient_MessageReceived(object sender, MessageReceivedEventArgs
{
var senderName = TrackerBase.CorrectUserNamePronunciation(e.Message.Sender);

if (e.Message.SenderUserName.Equals("Dr_Dubz", StringComparison.OrdinalIgnoreCase))
ProcessDrDubzChatMessage(e.Message, senderName);

if (ShouldRespondToGreetings)
TryRespondToGreetings(e.Message, senderName);

Expand Down Expand Up @@ -491,6 +494,15 @@ private void ProcessModChatCommand(ChatMessage message, string senderNamePronunc
}
}

private void ProcessDrDubzChatMessage(ChatMessage message, string senderNamePronunciation)
{
var drDubzArtLinkPattern = new Regex("(https://(i\\.)?imgur\\.com/)", RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(500));
if (drDubzArtLinkPattern.IsMatch(message.Text))
{
TrackerBase.Say(x => x.Chat.DrDubzArtPosted);
}
}

private void ChatClient_Connected(object? sender, EventArgs e)
{
TrackerBase.Say(x => x.Chat.WhenConnected);
Expand Down

0 comments on commit 78aea17

Please sign in to comment.