예제 #1
0
        private async Task TriggerOnMessageHandler()
        {
            var messages = new ChatMessage[]
            {
                new ChatMessage(null, "userId", "delegate_", "Delegate_", "colorHex", System.Drawing.Color.Transparent, null, "!requests", TwitchLib.Client.Enums.UserType.Viewer, "SaltySadism", "id", false, 0, "roomId", false, false, false, false, false, false, false, TwitchLib.Client.Enums.Noisy.NotSet, null, null, null, null, 0, 0),
                new ChatMessage(null, "userId", "delegate_", "Delegate_", "colorHex", System.Drawing.Color.Transparent, null, "!requests 1", TwitchLib.Client.Enums.UserType.Viewer, "SaltySadism", "id", false, 0, "roomId", false, false, false, false, false, false, false, TwitchLib.Client.Enums.Noisy.NotSet, null, null, null, null, 0, 0),
                new ChatMessage(null, "userId", "delegate_", "Delegate_", "colorHex", System.Drawing.Color.Transparent, null, "!requests me", TwitchLib.Client.Enums.UserType.Viewer, "SaltySadism", "id", false, 0, "roomId", false, false, false, false, false, false, false, TwitchLib.Client.Enums.Noisy.NotSet, null, null, null, null, 0, 0), new ChatMessage(null, "userId", "userName", "displayName", "colorHex", System.Drawing.Color.Transparent, null, "message", TwitchLib.Client.Enums.UserType.Viewer, "SaltySadism", "id", false, 0, "roomId", false, false, false, false, false, false, false, TwitchLib.Client.Enums.Noisy.NotSet, null, null, null, null, 0, 0)
            };

            while (!tokenProvider.Token.IsCancellationRequested)
            {
                foreach (var message in messages)
                {
                    onMessageHandler.Handle(new OnMessageReceivedArgs()
                    {
                        ChatMessage = message
                    });

                    logger.LogDebug("waiting to send messages...");
                    await Task.Delay(TimeSpan.FromSeconds(2));
                }
            }
        }
예제 #2
0
 private void Client_OnMessageReceived(object sender, OnMessageReceivedArgs e)
 {
     onMessageHandler.Handle(e);
 }