コード例 #1
0
 private void TwitchClient_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     if (_twitchClient.IsConnected)
     {
         _twitchClient.Disconnect();
     }
 }
コード例 #2
0
        private void OnBotMessageSent(object sender, OnMessageSentArgs e)
        {
            StyleSheet styleSheet = new StyleSheet(Color.White);

            styleSheet.AddStyle(e.SentMessage.DisplayName, ColorTranslator.FromHtml(e.SentMessage.ColorHex));

            ConsoleHelper.WriteLineStyled($"[{DateTime.Now.ToString("T")}] {e.SentMessage.DisplayName}: {e.SentMessage.Message}", styleSheet);
        }
コード例 #3
0
        private void OnMessageSent(object sender, OnMessageSentArgs e)
        {
            string formatted = $"[{DateTime.Now.ToString("H:mm:ss")}] {client.TwitchUsername}: {e.SentMessage.Message}";

            if (textBoxChat.Text != "")
            {
                Invoke(new Action(() => { textBoxChat.Text += Environment.NewLine; }));
            }
            Invoke(new Action(() => { textBoxChat.Text += formatted; }));
        }
コード例 #4
0
        private void Client_OnMessageSent(object sender, OnMessageSentArgs e)
        {
            consoleMessage[1] = "#";
            consoleMessage[3] = e.SentMessage.DisplayName;
            consoleMessage[4] = e.SentMessage.Channel;
            consoleMessage[5] = e.SentMessage.Message;

            //string message = $"[{DateTime.Now.ToString("MM/dd - HH:mm")} | Twitch.#{e.SentMessage.Channel}<<] {e.SentMessage.DisplayName}: {e.SentMessage.Message}";
            Program.SendToConsole(consoleMessage, true);
        }
コード例 #5
0
 private void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     if (!PrintLog)
     {
         return;
     }
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine($"#{e.SentMessage.Channel,-11} | {Settings.Username} {e.SentMessage.Message}");
     Console.ForegroundColor = ConsoleColor.White;
 }
コード例 #6
0
        /// <summary>
        /// When bot sends a message.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void TwitchClient_OnMessageSent(Object sender, OnMessageSentArgs e)
        {
            // Avoid infinite recursion.
            if (e.SentMessage.Message.StartsWith('.'))
            {
                return;
            }

            ChangeColor();
        }
コード例 #7
0
        /// <summary>
        /// Invokes the message sent.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="badges">The badges.</param>
        /// <param name="channel">The channel.</param>
        /// <param name="colorHex">The color hexadecimal.</param>
        /// <param name="displayName">The display name.</param>
        /// <param name="emoteSet">The emote set.</param>
        /// <param name="isModerator">if set to <c>true</c> [is moderator].</param>
        /// <param name="isSubscriber">if set to <c>true</c> [is subscriber].</param>
        /// <param name="userType">Type of the user.</param>
        /// <param name="message">The message.</param>
        public static void InvokeMessageSent(this TwitchClient client, List <KeyValuePair <string, string> > badges, string channel, string colorHex,
                                             string displayName, string emoteSet, bool isModerator, bool isSubscriber, UserType userType, string message)
        {
            OnMessageSentArgs model = new OnMessageSentArgs()
            {
                SentMessage = new SentMessage(badges, channel, colorHex, displayName, emoteSet, isModerator, isSubscriber, userType, message)
            };

            client.RaiseEvent("OnMessageSent", model);
        }
コード例 #8
0
        public void ShouldIgnoreCommands()
        {
            var args = new OnMessageSentArgs()
            {
                SentMessage = SentMessageBuilder
                              .Create()
                              .WithMessage('.' + Message)
                              .Build()
            };

            Sut.TwitchClient_OnMessageSent(null, args);

            MockedTwitchClientManager
            .Verify(x => x.SpoolMessage(PrimaryChannelName, It.IsAny <String>(), Priority.Medium), Times.Never());
        }
コード例 #9
0
        public void ShouldSetColorFromColorSelector()
        {
            var args = new OnMessageSentArgs()
            {
                SentMessage = SentMessageBuilder
                              .Create()
                              .WithMessage(Message)
                              .Build()
            };

            Sut.TwitchClient_OnMessageSent(null, args);

            MockedTwitchClientManager
            .Verify(x => x.SpoolMessage(PrimaryChannelName, $".color {Color1}", Priority.Medium), Times.Once());
        }
コード例 #10
0
        private void OnMessageSent(object sender, OnMessageSentArgs e)
        {
            string states  = "";
            string ChatM   = "";
            string content = "";

            DispName  = states + e.SentMessage.DisplayName;
            ChatM     = e.SentMessage.Message;
            NameColor = e.SentMessage.ColorHex;
            if (e.SentMessage.IsSubscriber)
            {
                states += "<img src=\"" + GetBadges(C_ID, "subscriber") + "\"> ";
            }
            if (e.SentMessage.UserType.ToString() == "Admin")
            {
                states += "<img src=\"" + GetBadges(C_ID, "admin") + "\"> ";
            }
            if (e.SentMessage.IsModerator)
            {
                states += "<img src=\"" + GetBadges(C_ID, "mod") + "\"> ";
            }
            if (e.SentMessage.UserType.ToString() == "Broadcaster")
            {
                states += "<img src=\"" + GetBadges(C_ID, "broadcaster") + "\"> ";
            }
            content = "<div><span style=\"color:" + NameColor + "; font-family:Arial,Helvetica,sans-serif; font-size:10pt;\"><strong>" + DispName.ToString() + ": </strong></span><span style=\"font-family:Arial,Helvetica,sans-serif; font-size:10pt;\">" + ChatM + "</span></div>";
            if (webChat.InvokeRequired)
            {
                Action act = () => this.webChat.Document.Body.InnerHtml += content;
                webChat.Invoke(act);
                act = () => ScrollToBottom();
                webChat.Invoke(act);
            }
            else
            {
                this.webChat.DocumentText += content;
            }
        }
コード例 #11
0
ファイル: DrakeBot.cs プロジェクト: curin/AzureDrakeBot
 private void _client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
 }
コード例 #12
0
 private async void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     await _eventProxy.PublishAsync(new TwitchMessageSentNotification(this, e.SentMessage))
     .ConfigureAwait(false);
 }
コード例 #13
0
ファイル: Bot.cs プロジェクト: mluanastevensc/csharp-projects
 private void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     Console.WriteLine($"{Config.Instance.ChannelName} >>> {e.SentMessage.Message}");
 }
コード例 #14
0
ファイル: TwitchConnection.cs プロジェクト: uurha/WEBVips
 private void OnMessageSent(object sender, OnMessageSentArgs e)
 {
     Debug.Log(e.SentMessage.Message);
 }
コード例 #15
0
 private void OnBotMessageSent(object sender, OnMessageSentArgs e)
 {
     ConsoleHelper.WriteLineChat($"{e.SentMessage.DisplayName}: {e.SentMessage.Message}");
 }
コード例 #16
0
 void OnMessageSent(object sender, OnMessageSentArgs e)
 {
     Debug.Log(e.SentMessage.Channel + ": " + e.SentMessage.DisplayName + ": " + e.SentMessage.Message);
 }
コード例 #17
0
 private void OnMessageSent(object sender, OnMessageSentArgs e)
 {
     Debug.Log("<color=blue> MSG:  " + e.SentMessage.DisplayName + "--" + e.SentMessage.Message + "</color>");
 }
コード例 #18
0
 /// <summary>
 /// Passes <see cref="OnMessageSent"/> events down to subscribed plugins.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="OnMessageSentArgs"/> object.</param>
 private void TwitchClient_OnMessageSent(object sender, OnMessageSentArgs e) => this.OnMessageSent?.Invoke(this, e);
コード例 #19
0
ファイル: TwitchChatBot.cs プロジェクト: str1py/Ducky_twitch
 private void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     logService.Add($"{e.SentMessage.DisplayName}: {e.SentMessage.Message}", MessageType.Type.EVENT,
                    MethodBase.GetCurrentMethod().DeclaringType);
 }
コード例 #20
0
ファイル: Form1.cs プロジェクト: kouweizhong/TwitchLib
 private void onMessageSent(object sender, OnMessageSentArgs e)
 {
     richTextBox1.Text += $"\n[via onMessageSent] [Me]{e.SentMessage.DisplayName} [mod: {e.SentMessage.IsModerator}] [sub: {e.SentMessage.IsSubscriber}]: {e.SentMessage.Message}";
 }
コード例 #21
0
 private void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     Log.Information("Message sent: {message}", e.SentMessage.Message);
 }
コード例 #22
0
 /// <summary>
 /// Called when the Twitch bot has sent a chat message.
 /// </summary>
 private static void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     Console.WriteLine($"[{e.SentMessage.Channel}] {e.SentMessage.DisplayName} has sent a message: {e.SentMessage.Message}");
 }
コード例 #23
0
 private void OnMessageSent(object sender, OnMessageSentArgs e)
 {
     Debug.Log("<color=blue> MSG:  " + e.SentMessage.DisplayName + "--" + e.SentMessage.Message + "</color>");
     CreateChatLine(e.SentMessage.DisplayName, e.SentMessage.Message, e.SentMessage.ColorHex);
 }
コード例 #24
0
 private void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     this.Dispatcher.Invoke(() => Chat.Items.Insert(0, e.SentMessage.DisplayName.ToString() + " : " + e.SentMessage.Message.ToString()));
     this.Dispatcher.Invoke(() => controlListMemory());
 }
コード例 #25
0
 private async void TwitchOnMessageSent(object sender, OnMessageSentArgs e)
 {
     await Program.BotEvents.RaiseOnTwitchMessageSent(e.SentMessage.Channel, e.SentMessage.Message);
 }
コード例 #26
0
 private void Client_OnMessageSent(object sender, OnMessageSentArgs e)
 {
     //Console.WriteLine("received message from {0}, chatting: {1}: ", e.ChatMessage.DisplayName, $" {SenderString}, {e.ChatMessage.DisplayName}");
 }