Beispiel #1
0
        public void OnBitsReceived(object sender, OnBitsReceivedArgs e)
        {
            var message = $"Just received {e.BitsUsed} bits from {e.Username}. That brings their total to {e.TotalBitsUsed} bits!";

            Console.WriteLine(message);
            //  new CommandAnnounce(client).Execute(message);
        }
Beispiel #2
0
        internal async Task TryAddBitRequestToEffectQueueAsync(OnBitsReceivedArgs e)
        {
            if (e.BitsUsed < settings.minimumBitAmount)
            {
                string msgUnderMinimumBitAmount = settings.msgUnderMinimumBitAmount.Replace("{username}", e.Username);
                twitchClient.SendMessage(settings.botJoinChannel, msgUnderMinimumBitAmount);
                Log.Information("Bit donation to small");
            }

            string effect = await GetEffectFromMessageAsync(e.ChatMessage);

            if (effect == null)
            {
                string msgEffectNotFound = settings.msgEffectNotFound.Replace("{username}", e.Username);
                twitchClient.SendMessage(settings.botJoinChannel, msgEffectNotFound);
                Log.Information("Effect not found");
                return;
            }

            BitEffect be = new BitEffect(effect, e.Username, e.BitsUsed);

            queue.EnqueueBitEffect(be);
            if (queue.Count > 1)
            {
                Log.Information($"EFFECT ADDED TO QUEUE: {e.Username}, {e.BitsUsed} bits, {effect}," +
                                $" {be.Milliseconds / 1000} seconds, position {queue.Count}");
                string msgBitQueue = settings.msgAddedToQueue.Replace("{username}", e.Username).Replace("{position}", queue.Count + "");
                twitchClient.SendMessage(settings.botJoinChannel, msgBitQueue);
            }
        }
Beispiel #3
0
        public async Task <IActionResult> NewCheer()
        {
            OnBitsReceivedArgs bitsReceived = new OnBitsReceivedArgs()
            {
                BitsUsed = 10000,
                Username = "******"
            };
            await _hubContext.Clients.All.SendAsync("ReceiveNewCheer", bitsReceived);

            return(RedirectToAction("test"));
        }
Beispiel #4
0
        private async void ProcessReceivedChatCommand(object sender, OnChatCommandReceivedArgs e)
        {
            if (!e.Command.ChatMessage.IsModerator && !e.Command.ChatMessage.IsBroadcaster)
            {
                return;
            }
            if (!e.Command.CommandText.ToLower().Equals("ortobot"))
            {
                return;
            }

            string message = e.Command.ChatMessage.Message.ToLower();

            if (message.Contains("reset"))
            {
                ortoBot.Reset();
            }
            else if (message.Contains("queue"))
            {
                ortoBot.ShowQueue();
            }
            else if (message.Contains("current"))
            {
                ortoBot.ShowCurrent();
            }
            else if (message.Contains("effects"))
            {
                ortoBot.ShowEffects();
            }
            else if (message.Contains(settings.requestCommand))
            {
                int bits;
                int.TryParse(ChatMessageParser.GetKeywordValue(message, "bits:"), out bits);
                if (bits <= 0)
                {
                    return;
                }

                string username = ChatMessageParser.GetKeywordValue(message, "username:"******"{e.Command.ChatMessage.DisplayName} has just added an effect with the mod tool: {e.Command.ChatMessage.Message}";
                Log.Information(msg);
                await ortoBot.TryAddBitRequestToEffectQueueAsync(obr);
            }
        }
Beispiel #5
0
        internal async Task HandleReceivedBitsAsync(OnBitsReceivedArgs args)
        {
            Console.WriteLine();
            string msg = $"{args.Username} has just sent {args.BitsUsed} bits!\n" +
                         $"(Total {args.TotalBitsUsed}, {args.ChatMessage}, {args.Context})";

            Log.Information(msg);
            if (args.ChatMessage.Contains(settings.requestCommand))
            {
                await TryAddBitRequestToEffectQueueAsync(args);
            }
        }
Beispiel #6
0
 private void onBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     try
     {
         Console.Out.WriteLine("Bits Dropped :O!");
         Console.Out.WriteLine($"{e.Username} - {e.TotalBitsUsed}");
         var vipGiven = vipHelper.GiveDonationVip(e.Username, e.TotalBitsUsed);
     }
     catch (Exception ex)
     {
         Console.Out.WriteLine(ex.ToString());
     }
 }
Beispiel #7
0
        private static async void OnBitsReceived(object sender, OnBitsReceivedArgs e)
        {
            var embed = new DiscordEmbedBuilder
            {
                Color    = DiscordColor.Purple,
                ImageUrl = "https://cdn.twitchalerts.com/twitch-bits/images/hd/100.gif",
                Title    = "Bits! Bits! Bits!",
                Url      = "https://www.twitch.tv/phenomalytv",
            };

            embed.AddField("PhenomalyTV HAS RECEIVED BITSSS!", $"{e.BitsUsed} bits from {e.Username}. That brings their total to {e.TotalBitsUsed} bits!");

            var chan = await TwitchBotMain.discord.GetChannelAsync(552255972060692504);

            await chan.SendMessageAsync("\n", embed : embed);
        }
Beispiel #8
0
        private void OnBitsReceived(object sender, OnBitsReceivedArgs e)
        {
            try
            {
                _logger.LogInformation(
                    $"Bits Dropped :O!  {e.Username} dropped {e.BitsUsed} - Total {e.TotalBitsUsed}");

                _vipApiClient.UpdateBitsDropped(new UpdateTotalBitsDroppedRequest
                {
                    Username         = e.Username,
                    TotalBitsDropped = e.TotalBitsUsed
                });
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error OnBitsReceived");
            }
        }
Beispiel #9
0
        public void OnBitsReceivedEvent(OnBitsReceivedArgs args)
        {
            this.OnBitsReceived?.Invoke(this, args);

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

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

            tokenReplacements.Add(new KeyValuePair <string, string>("{{user}}", args.Username));
            tokenReplacements.Add(new KeyValuePair <string, string>("{{bits}}", args.BitsUsed.ToString()));
            tokenReplacements.Add(new KeyValuePair <string, string>("{{total_bits}}", args.TotalBitsUsed.ToString()));
            tokenReplacements.Add(new KeyValuePair <string, string>("{{message}}", args.ChatMessage));

            foreach (var bitEvent in this.events[EventType.Bits])
            {
                SendEventMessageInChat(bitEvent, tokenReplacements);
            }
        }
Beispiel #10
0
        /// <summary>
        /// NuJuan Verification in progress TODO!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        private async void OnBitsReceived(object sender, OnBitsReceivedArgs e)
        {
            BotChannel bChan = await Program.Channels.GetTwitchChannelByName(_twitchChannelName);

            UserEntry user = await Program.Users.GetUserByTwitchID(e.UserId);

            if (user != null && bChan != null)
            {
                BitEventArguments bitEvent = new BitEventArguments(
                    bChan,
                    user,
                    Core.CurrentTime,
                    e.BitsUsed,
                    e.TotalBitsUsed,
                    e.Context,
                    e.ChatMessage
                    );
                await Core.LOG(new LogEntry(LOGSEVERITY.WARNING, "PubSub", $"OnBitsReceived({_twitchChannelName}) {e.BitsUsed} from {user._twitchDisplayname}"));

                Program.BotEvents.RaiseBitEvent(bitEvent);
            }
        }
Beispiel #11
0
 public async Task BroadcastNewCheer(OnBitsReceivedArgs onBitsReceivedArgs)
 {
     await _alertHubConnection.InvokeAsync("BroadcastNewCheer", onBitsReceivedArgs);
 }
Beispiel #12
0
 private void onBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     Console.WriteLine($"BITS: {e.BitsUsed} from {e.Username}");
 }
 /// <summary>
 /// Passes <see cref="OnBitsReceived"/> events down to subscribed plugins.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="OnBitsReceivedArgs"/> object.</param>
 private void TwitchPubSub_OnBitsReceived(object sender, OnBitsReceivedArgs e) => OnBitsReceived?.Invoke(this, e);
 //Test Method to see bit redemption
 private void Pubsub_OnBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     Console.WriteLine($"Just received {e.BitsUsed} bits from {e.Username}. That brings their total to {e.TotalBitsUsed} bits!");
 }
 private void PubSub_OnBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     _logger.Information($"{e.Username} trowed {e.TotalBitsUsed} bits");
 }
Beispiel #16
0
 private async Task OnBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     await BroadcastNewCheer(e);
 }
Beispiel #17
0
 private void OnBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     form.WriteChat(e.Username + " just dropped " + e.TotalBitsUsed + " bits! Thank you itslitHype itslitHype itslitHype", true);
     form.AddEvent(e.Username + " " + e.TotalBitsUsed + " bits");
     //Twitch_Bot.Client.Send(Resources.channel_name, e.Username + " just dropped " + e.TotalBitsUsed + " bits! Thank you itslitHype itslitHype itslitHype");
 }
Beispiel #18
0
 public Task BroadcastCheer(OnBitsReceivedArgs bitsReceived)
 {
     return(Clients.All.SendAsync("ReceiveNewCheer", bitsReceived));
 }
Beispiel #19
0
 internal void PubSub_OnBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     chatbot.ManualMessage($"Thanks for the {e.BitsUsed} bits, {e.Username}!!");
 }
Beispiel #20
0
 public async Task BroadcastNewCheer(OnBitsReceivedArgs onBitsReceivedArgs)
 {
     await Clients.All.ReceiveNewCheer(onBitsReceivedArgs);
 }
Beispiel #21
0
 private static async void OnBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     await _overlayHubContext.Clients.All.SendAsync("ReceiveNewCheer", e);
 }
Beispiel #22
0
 private void pubsubOnBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     MessageBox.Show($"Just received {e.BitsUsed} bits from {e.Username}. That brings their total to {e.TotalBitsUsed} bits!");
 }
 private async void onBitsReceived(object sender, OnBitsReceivedArgs e)
 {
     //todo
 }