Ejemplo n.º 1
0
        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");
                }
            }
        }
Ejemplo n.º 2
0
        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");
                }
            }
        }
Ejemplo n.º 3
0
 public void RaisePageAlert(string message, string color)
 {
     PageRaised?.Invoke(this, new PageRaisedEventArgs(message, color));
 }
Ejemplo n.º 4
0
 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));
 }