Esempio n. 1
0
 public ChatMessage FormatMessage(string message, string channelName)
 {
     if (message.IndexOf($"privmsg #{channelName}", StringComparison.OrdinalIgnoreCase) >= 0)
     {
         var username        = message.Split('!').First()[1..];
         var usernameColor   = GetUsernameColor(username);
         var strippedMessage = ": " + Regex.Split(message, $"privmsg #{channelName} :", RegexOptions.IgnoreCase).Last();
         return(new ChatMessage {
             DateTime = DateTime.Now, Username = username, UsernameColor = usernameColor, Message = strippedMessage
         });
     }
     return(ChatMessage.Empty());
 }