Beispiel #1
0
        private void ListenForEntries(object sender, NewMessageArgs args)
        {
            var message = minigamesForm.keywordCaseSensitive.Checked ? args.Message : args.Message.ToLower();

            if (message.Contains(_keyword))
            {
                if (!_joinedViewers.Contains(args.Speaker))
                {
                    _joinedViewers.Add(args.Speaker);
                    minigamesForm.raffleJoinedLabel.Text += $"\r\n{args.Speaker}";
                }
            }
        }
Beispiel #2
0
 public void HandleResponse(Response response)
 {
     try
     {
         foreach (string output in response.Output)
         {
             NewMessageArgs args = new NewMessageArgs
             {
                 Timestamp = DateTime.Now,
                 Name      = "Noah",
                 Message   = output
             };
             NoahServer.Instance.SendMessage(args);
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }
Beispiel #3
0
        private static void ReceiveMessage(string speaker, string message)
        {
            if (OnNewMessage != null)
            {
                NewMessageArgs args = new NewMessageArgs();
                args.Speaker = speaker;
                args.Message = message;
                OnNewMessage(null, args);
            }

            if (message.ToLower().StartsWith(BotCommandPrefix))
            {
                if (ChatLog.Count > 20)
                {
                    ChatLog.RemoveAt(0);
                }

                ChatLog.Add($"\r\n[{speaker}]: {message}");

                _commands = GetAllCommands();

                if (_commands.Count > 0)
                {
                    foreach (dynamic command in _commands)
                    {
                        if (message.ToLower().Contains(command.CommandText.ToLower()) && message[1] != ' ')
                        {
                            if (command.IsBotCommand)
                            {
                                RunBotCommand(speaker, message);
                            }
                            else if (command.Response.Length > 0)
                            {
                                SendTwitchMessage(command.Response);
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
 static void HandleNewMessage(NewMessageArgs args)
 {
     System.Console.WriteLine($"[{args.Timestamp}] {args.Name} > {args.Message}");
     System.Console.Write("> ");
 }
Beispiel #5
0
 public void SendMessage(NewMessageArgs args)
 {
     Instance.Clients.All.NewMessage(args);
 }