Ejemplo n.º 1
0
 private void Raid(OnRaidNotificationArgs args)
 {
     if (Config.Currency.Enabled)
     {
         HandleCurrency(args);
     }
 }
Ejemplo n.º 2
0
 private void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     if (BotEnvironment.Settings["show.debug"] == "true")
     {
         Logger.WriteLine("Client_OnRaidNotification", Color.DarkCyan);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Fires when a raid notification is detected in chat
 /// </summary>
 private async void OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     BotChannel bChan = await Program.Channels.GetTwitchChannelByName(e.Channel);
     int i = 0;
     int.TryParse(e.RaidNotification.MsgParamViewerCount, out i);
     Program.BotEvents.RaiseRaidEvent(bChan, new RaidEventArguments(e.RaidNotification.DisplayName, e.Channel, i));
 }
Ejemplo n.º 4
0
        private void ProcessIncomingRaid(object sender, OnRaidNotificationArgs e)
        {
            RaidNotification raid = e.RaidNotification;
            string           msg  = $"{raid.DisplayName}, {raid.MsgParamDisplayName}, {raid.MsgParamViewerCount}";

            Log.Information(msg);
        }
Ejemplo n.º 5
0
        private async void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
        {
            int.TryParse(e.RaidNotification.MsgParamViewerCount, out var count);

            count = count != 0 ? count : 1;

            await _connection.InvokeAsync("Raid", count);
        }
Ejemplo n.º 6
0
        public void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
        {
            var message = $"Thanks for the RAID {e.RaidNotification.DisplayName}!  How was your stream?";

            sayingResponse.SaySomethingNice(message).Wait();

            this.client.SendMessage(e.Channel, message);
        }
Ejemplo n.º 7
0
        private void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
        {
            Console.WriteLine($"(RAID) {e.RaidNotification.DisplayName} has raided with {e.RaidNotification.MsgParamViewerCount} viewers");
            client.SendMessage(TwitchInfo.ChannelName, $"INCOMINGGGGGG raid of {e.RaidNotification.MsgParamViewerCount} viewers from {e.RaidNotification.DisplayName}");
            client.SendMessage(TwitchInfo.ChannelName, $"Chat, go drop a follow to {e.RaidNotification.DisplayName} for being awesome https://twitch.tv/{e.RaidNotification.DisplayName}");

            GAPIuser.AddPoints(e.RaidNotification.UserId, 150);
        }
Ejemplo n.º 8
0
        // Last example, raid notification. Log it out, increment the count and then call the subscription.
        private void OnClientRaidNotification(object sender, OnRaidNotificationArgs e)
        {
            Console.WriteLine($"{e.Channel} is raiding {e.RaidNotificaiton.DisplayName}");

            RaidsSinceStreamBegun++;

            // I hate when APIs have typos in them!
            OnRaidStarted?.Invoke(this, e.RaidNotificaiton.DisplayName);
        }
Ejemplo n.º 9
0
 private void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     // Say thank you for the raid 3 times.
     for (int i = 0; i < 3; i++)
     {
         new CommandAnnounce(client).Execute("Thank you for the raid!", e);
         new CommandAnnounce(client).Execute("Join the discord channel", e);
         new CommandAnnounce(client).Execute("!discord", e);
     }
 }
Ejemplo n.º 10
0
        public async Task <IActionResult> NewRaid()
        {
            OnRaidNotificationArgs onRaid = new OnRaidNotificationArgs()
            {
                RaidNotificaiton = new RaidNotification(new TwitchLib.Client.Models.Internal.IrcMessage("williamgates"))
            };

            await _hubContext.Clients.All.SendAsync("ReceiveNewRaid", onRaid);

            return(RedirectToAction("test"));
        }
Ejemplo n.º 11
0
 private void OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     if (int.TryParse(e.RaidNotification.MsgParamViewerCount, out var viewersCount))
     {
         WelcomeRaidOrHost(e.Channel, e.RaidNotification.MsgParamDisplayName, viewersCount, true);
     }
     else
     {
         _logger.LogError($"Raid Notification count is not a number: {e.RaidNotification?.MsgParamViewerCount}");
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Invokes the raid notification.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="channel">The channel.</param>
        /// <param name="badges">The badges.</param>
        /// <param name="color">The color.</param>
        /// <param name="displayName">The display name.</param>
        /// <param name="emotes">The emotes.</param>
        /// <param name="id">The identifier.</param>
        /// <param name="login">The login.</param>
        /// <param name="moderator">if set to <c>true</c> [moderator].</param>
        /// <param name="msgId">The MSG identifier.</param>
        /// <param name="msgParamDisplayName">Display name of the MSG parameter.</param>
        /// <param name="msgParamLogin">The MSG parameter login.</param>
        /// <param name="msgParamViewerCount">The MSG parameter viewer count.</param>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="subscriber">if set to <c>true</c> [subscriber].</param>
        /// <param name="systemMsg">The system MSG.</param>
        /// <param name="systemMsgParsed">The system MSG parsed.</param>
        /// <param name="tmiSentTs">The tmi sent ts.</param>
        /// <param name="turbo">if set to <c>true</c> [turbo].</param>
        /// <param name="userType">Type of the user.</param>
        /// <param name="userType">Id of user.</param>
        public static void InvokeRaidNotification(this TwitchClient client, string channel, List <KeyValuePair <string, string> > badges, List <KeyValuePair <string, string> > badgeInfo, string color, string displayName, string emotes, string id, string login, bool moderator, string msgId, string msgParamDisplayName,
                                                  string msgParamLogin, string msgParamViewerCount, string roomId, bool subscriber, string systemMsg, string systemMsgParsed, string tmiSentTs, bool turbo, UserType userType, string userId)
        {
            OnRaidNotificationArgs model = new OnRaidNotificationArgs()
            {
                Channel          = channel,
                RaidNotification = new RaidNotification(badges, badgeInfo, color, displayName, emotes, id, login, moderator, msgId, msgParamDisplayName, msgParamLogin, msgParamViewerCount,
                                                        roomId, subscriber, systemMsg, systemMsgParsed, tmiSentTs, turbo, userType, userId)
            };

            client.RaiseEvent("OnRaidNotification", model);
        }
Ejemplo n.º 13
0
        private void HandleCurrency(OnRaidNotificationArgs args)
        {
            // Exit if we do not meet the minimum of 3 viewers
            if (int.Parse(args.RaidNotificaiton.MsgParamViewerCount) < Config.Currency.AwardForRaid_Min)
            {
                return;
            }

            var currency = new int[] { Config.Currency.AwardForRaid_Min, int.Parse(args.RaidNotificaiton.MsgParamViewerCount) }.Max();

            currency = currency > Config.Currency.AwardForRaid_Max ? Config.Currency.AwardForRaid_Max : currency;

            CurrencyRepository.AddForUser(args.RaidNotificaiton.Login, currency, "Bot-Raid");
        }
Ejemplo n.º 14
0
Archivo: QTCore.cs Proyecto: dbqt/QTBot
        private void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
        {
            Utilities.Log("Raid notification with display name: " + e.RaidNotification.DisplayName);
            Utilities.Log("Raid notification with channel name: " + e.Channel);
            Utilities.Log("Raid notification with MsgParamDisplayName: " + e.RaidNotification.MsgParamDisplayName);
            Utilities.Log("Raid notification with MsgParamViewerCount: " + e.RaidNotification.MsgParamViewerCount);
            Utilities.Log("Raid notification with MsgParamLogin: "******"!so {e.RaidNotification.DisplayName}", 5000);
            }

            this.eventsManager?.OnRaidedEvent(e);
        }
Ejemplo n.º 15
0
        public void Test_Client_OnRaidNotification()
        {
            var    chatBot        = new TwitchStreamChatBot();
            string chatMessageRaw = "@badge-info=;badges=;color=#FF0000;display-name=LuckyNoS7evin;emotes=;msg-param-viewerCount=4;id=306b2ca4-c4ee-4449-84cc-ef5b5cc1c74f;login=LuckyNoS7evin;mod=0;msg-id=raid;room-id=61809127;subscriber=0;system-msg=;tmi-sent-ts=1570725601895;turbo=0;user-id=51497560;user-type= :tmi.twitch.tv USERNOTICE #nick_larsen :";
            var    ircMessage     = GetIrcMessage(chatMessageRaw);
            var    args           = new OnRaidNotificationArgs()
            {
                RaidNotificaiton = new TwitchLib.Client.Models.RaidNotification(ircMessage),
            };

            Assert.True(chatBot.EndOfStreamRaid == null);
            chatBot.Client_OnRaidNotification(null, args);
            Assert.True(chatBot.EndOfStreamRaid != null);

            var template = chatBot.PopulateMarkdownTemplate().ToString();

            Assert.Contains("TODO", template);
        }
Ejemplo n.º 16
0
        public void OnRaidedEvent(OnRaidNotificationArgs args)
        {
            this.OnRaid?.Invoke(this, args);

            if (!this.events.ContainsKey(EventType.Raid))
            {
                return;
            }

            var tokenReplacements = new List <KeyValuePair <string, string> >();

            tokenReplacements.Add(new KeyValuePair <string, string>("{{user}}", args.RaidNotification.MsgParamDisplayName));
            tokenReplacements.Add(new KeyValuePair <string, string>("{{count}}", args.RaidNotification.MsgParamViewerCount));

            foreach (var raidEvent in this.events[EventType.Raid])
            {
                SendEventMessageInChat(raidEvent, tokenReplacements);
            }
        }
Ejemplo n.º 17
0
        private void _Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
        {
            if (!EnableSubPixels)
            {
                return;
            }

            // Exit if we do not meet the minimum of 3 viewers
            if (int.Parse(e.RaidNotificaiton.MsgParamViewerCount) < 3)
            {
                return;
            }

            var pixels = new int[] { 3, int.Parse(e.RaidNotificaiton.MsgParamViewerCount) }.Max();

            pixels = pixels > 200 ? 200 : pixels;

            _GoogleSheet.AddPixelsForUser(e.RaidNotificaiton.DisplayName, pixels, "PixelBot-Raid");
        }
        public void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
        {
            var channel = e.RaidNotificaiton.DisplayName;
            var info    = new RaidInfo
            {
                Channel     = channel,
                EventTime   = DateTime.UtcNow, // TODO: get this from the timestamp
                ViewerCount = int.Parse(e.RaidNotificaiton.MsgParamViewerCount),
            };

            lock (raids)
            {
                if (!raids.ContainsKey(channel))
                {
                    raids.Add(channel, info);
                }
                else
                {
                    raids[channel] = info;
                }
            }
        }
Ejemplo n.º 19
0
 private void TwitchClient_OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     ShowMessage($"{ReplaceNickname(e.RaidNotification.DisplayName)} raidet mit {e.RaidNotification.MsgParamViewerCount} Leuten", Settings.RaidNotification);
 }
Ejemplo n.º 20
0
 private async Task Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     await BroadcastNewRaid(e);
 }
Ejemplo n.º 21
0
 private void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     SendChatMessage($"{e.RaidNotification.DisplayName}, thank you for raiding!");
 }
Ejemplo n.º 22
0
 public async Task BroadcastNewRaid(OnRaidNotificationArgs onRaidNotificationArgs)
 {
     await _alertHubConnection.InvokeAsync("BroadcastNewRaid", onRaidNotificationArgs);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Passes <see cref="OnRaidNotification"/> events down to subscribed plugins.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="OnRaidNotificationArgs"/> object.</param>
 private void TwitchClient_OnRaidNotification(object sender, OnRaidNotificationArgs e) => this.OnRaidNotification?.Invoke(this, e);
Ejemplo n.º 24
0
 private void OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
 }
Ejemplo n.º 25
0
 private void OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     this.Broadcast($"Thank you {e.RaidNotification.DisplayName} for the raid! <3");
 }
Ejemplo n.º 26
0
 private void OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     form.WriteChat(e.RaidNotificaiton.DisplayName + " raided!!!!!!!!", true);
 }
Ejemplo n.º 27
0
 private static void Client_OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     BotTools.LogLine($"Raid from: {e.RaidNotification.DisplayName}, Viewers: {e.RaidNotification.MsgParamViewerCount}, MsgParamDisplayName:{e.RaidNotification.MsgParamDisplayName}");
 }
Ejemplo n.º 28
0
 private void raidRecivido(object sender, OnRaidNotificationArgs e)
 {
     client.SendMessage(e.Channel, "Te recomendamos ver el contenido de @" + e.RaidNotificaiton.DisplayName + " en https://www.Twitch.com/" + e.RaidNotificaiton.DisplayName);
 }
Ejemplo n.º 29
0
 private void onRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     MessageBox.Show($"Raid detected from: {e.RaidNotificaiton.MsgParamLogin}, with {e.RaidNotificaiton.MsgParamViewerCount} viewers.");
 }
Ejemplo n.º 30
0
 public static void OnRaidNotification(object sender, OnRaidNotificationArgs e)
 {
     Log.Message("Being raided by " + e.RaidNotification.DisplayName);
 }