private void ParseCommand(ChatCommand cmd) { var msg = cmd.ChatMessage; if (cmd.CommandText.ToLowerInvariant() == REPLAY_COMMAND) { Logger.Instance.LogMessage(TracingLevel.INFO, $"{msg.DisplayName} requested a replay"); if (PageRaised != null) { // Are we under cooldown? if ((DateTime.Now - lastPage).TotalSeconds > pageCooldown) { // Is this person allowed to replay? if (allowReplayCommand && (allowedPagers == null || allowedPagers.Count == 0 || allowedPagers.Contains(msg.DisplayName.ToLowerInvariant()))) { lastPage = DateTime.Now; PageRaised?.Invoke(this, new PageRaisedEventArgs(cmd.ArgumentsAsString)); /* * if (!String.IsNullOrWhiteSpace(ChatMessage)) * { * string chatMessage = ChatMessage.Replace("{USERNAME}", $"@{msg.DisplayName}"); * client.SendMessage(msg.Channel, chatMessage); * }*/ } else { Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot replay, user {msg.DisplayName} is not allowed to replay. AllowReplay: {allowReplayCommand}"); } } else { Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot replay, cooldown enabled"); } } else { Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot replay, no plugin is currently enabled"); } } }
private void ParseCommand(ChatCommand cmd) { var msg = cmd.ChatMessage; if (cmd.CommandText.ToLowerInvariant() == PageCommand) { Logger.Instance.LogMessage(TracingLevel.INFO, $"{msg.DisplayName} requested a page"); if (PageRaised != null) { if ((DateTime.Now - lastPage).TotalSeconds > pageCooldown) { if (allowedPagers == null || allowedPagers.Count == 0 || allowedPagers.Contains(msg.DisplayName.ToLowerInvariant())) { lastPage = DateTime.Now; PageRaised?.Invoke(this, new PageRaisedEventArgs(cmd.ArgumentsAsString, null)); if (!String.IsNullOrWhiteSpace(ChatMessage)) { string chatMessage = ChatMessage.Replace("{USERNAME}", $"@{msg.DisplayName}"); client.SendMessage(msg.Channel, chatMessage); } } else { Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot page, user {msg.DisplayName} is not allowed to page"); } } else { Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot page, cooldown enabled"); } } else { Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot page, no plugin is currently enabled"); } } }
public void RaisePageAlert(string message, string color) { PageRaised?.Invoke(this, new PageRaisedEventArgs(message, color)); }
public void RaisePageAlert(string message, string color) { Logger.Instance.LogMessage(TracingLevel.INFO, $"Twitch Chat received Page command: {message}"); PageRaised?.Invoke(this, new PageRaisedEventArgs(message, color)); }