Esempio n. 1
0
        private async void Client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
        {
            try
            {
                if (e.GiftedSubscription.DisplayName != "AnAnonymousGifter")
                {
                    var user = await dataHelper.GetUserFromCommunitySubs(e);

                    db.EditExpViaCommunitySubGifts(user, e.GiftedSubscription.MsgParamMassGiftCount);
                    logService.Add($":{e.GiftedSubscription.DisplayName} Gift count: {e.GiftedSubscription.MsgParamMassGiftCount}. Gift in Total:{e.GiftedSubscription.MsgParamSenderCount}", MessageType.Type.EVENT,
                                   MethodBase.GetCurrentMethod().DeclaringType);
                    // client.SendMessage(Startup.streamerName, "olyashFonarik olyashFonarik olyashFonarik olyashFonarik");
                }
                else
                {
                    logService.Add($" Anon sen GIFTS!!!!: {e.GiftedSubscription.MsgParamMassGiftCount}", MessageType.Type.ANONGIFT,
                                   MethodBase.GetCurrentMethod().DeclaringType);
                }
            }
            catch (Exception ex)
            {
                logService.Add(ex, MessageType.Type.ERROR,
                               MethodBase.GetCurrentMethod().DeclaringType);
            }
            //client.SendMessage(_broadcasterName, "olyashFonarik olyashFonarik olyashFonarik olyashFonarik");
        }
        public static void CheckForCommunitySubEvents(object sender, OnCommunitySubscriptionArgs e)
        {
            CommunitySubscription g = e.GiftedSubscription;

            Log.Message($"CommunitySubscription = Anonymous: {g.IsAnonymous} - MassGiftCount: {g.MsgParamMassGiftCount} - SenderCounter: {g.MsgParamSenderCount} SubPlan: {g.MsgParamSubPlan}");

            List <Event> eventsWithCommunitySubTriggers = Events.All.Where((x) => x.communitySubs).ToList();

            foreach (Event evt in eventsWithCommunitySubTriggers)
            {
                bool fire = false;

                if (e.GiftedSubscription.MsgParamSubPlan.ToString() == "Tier1" && evt.tierOneSubs)
                {
                    fire = true;
                }
                else if (e.GiftedSubscription.MsgParamSubPlan.ToString() == "Tier2" && evt.tierTwoSubs)
                {
                    fire = true;
                }
                else if (e.GiftedSubscription.MsgParamSubPlan.ToString() == "Tier3" && evt.tierThreeSubs)
                {
                    fire = true;
                }

                if (fire)
                {
                    evt.FireEvents(e.GiftedSubscription.DisplayName);
                }
            }
        }
Esempio n. 3
0
        private static void Client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
        {
            int    giftAmount = e.GiftedSubscription.MsgParamMassGiftCount;
            string subWords   = giftAmount > 1 ? $"{giftAmount} subscriptions" : "a subscription";

            BotTools.LogLine($"{e.GiftedSubscription.DisplayName} gifted {subWords} " +
                             $"({e.GiftedSubscription.MsgParamSenderCount} total)");
        }
        private void Client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
        {
            ChannelUser user         = new ChannelUser(e.GiftedSubscription.UserId, e.GiftedSubscription.DisplayName, e.GiftedSubscription.DisplayName);
            ChannelUser resolvedUser = usernameResolver.ResolveUsername(user);

            CommunitySubscriptionEvent communitySubscription = new CommunitySubscriptionEvent(resolvedUser, e.GiftedSubscription.MsgParamMassGiftCount);

            bus.Publish(communitySubscription);
        }
        public static void KiraOnCommunitySubscription(object s, OnCommunitySubscriptionArgs e, CallbackArgs args)
        {
            // var _massGiftCount = e.GiftedSubscription.MsgParamMassGiftCount;
            var answer = e.GiftedSubscription.MsgParamMassGiftCount == 1
                ? $"{e.GiftedSubscription.DisplayName}, спасибо за подарочную подписку! PrideFlower"
                : $"{e.GiftedSubscription.DisplayName}, спасибо за подарочные подписки! peepoLove peepoLove peepoLove";

            BotService.BotTwitchClient.SendMessage(e.Channel, answer);
        }
Esempio n. 6
0
        private void OnPrimeSub(object sender, OnCommunitySubscriptionArgs e)
        {
            this.messageBus.Send(nameof(TwitchSubscription),
                                 new TwitchSubscription(
                                     e.GiftedSubscription.UserId,
                                     e.GiftedSubscription.Login,
                                     e.GiftedSubscription.DisplayName, 1, false));

            this.Broadcast($"Thank you {e.GiftedSubscription.DisplayName} for the sub!!! <3");
        }
        public void Client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
        {
            var info = new SubscriptionInfo
            {
                GiftedByUserDisplayName = e.GiftedSubscription.DisplayName,
                PlanName    = e.GiftedSubscription.MsgParamSubPlan.ToString(),
                GiftedCount = e.GiftedSubscription.MsgParamMassGiftCount,
            };

            OnSub(info);
        }
Esempio n. 8
0
        private void OnSubBomb(object sender, OnCommunitySubscriptionArgs e)
        {
            try
            {
                _logger.LogInformation($"Sub Bomb!!! {e.GiftedSubscription.DisplayName} has gifted {e.GiftedSubscription.MsgParamMassGiftCount} subs!");

                // Leaving blank for now, it is assumed that subbomb gifts go through gift event too, so relevant vips and bytes will be handled there.
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error OnSubBomb");
            }
        }
Esempio n. 9
0
        private void OnPrimeSub(object sender, OnCommunitySubscriptionArgs e)
        {
            this.messageBus.Send(nameof(TwitchSubscription),
                                 new TwitchSubscription(
                                     e.Channel,
                                     e.GiftedSubscription.UserId,
                                     e.GiftedSubscription.Login,
                                     e.GiftedSubscription.DisplayName,
                                     null,
                                     e.GiftedSubscription.IsModerator,
                                     e.GiftedSubscription.IsSubscriber,
                                     1, false));

            this.Broadcast("", Localization.Twitch.THANK_YOU_SUB, e.GiftedSubscription.DisplayName);
        }
Esempio n. 10
0
        public void Test_Client_OnCommunitySubscription()
        {
            var    chatBot        = new TwitchStreamChatBot();
            string chatMessageRaw = "TODO";
            var    ircMessage     = GetIrcMessage(chatMessageRaw);
            var    args           = new OnCommunitySubscriptionArgs()
            {
                GiftedSubscription = new TwitchLib.Client.Models.CommunitySubscription(ircMessage),
            };

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

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

            Assert.Contains("TODO", template);
        }
Esempio n. 11
0
        public async Task <TwitchUserModel> GetUserFromCommunitySubs(OnCommunitySubscriptionArgs data)
        {
            try
            {
                var  badges = data.GiftedSubscription.Badges;
                bool vip;
                if (badges[2] == 1)
                {
                    vip = true;
                }
                else
                {
                    vip = false;
                }

                var user = (new TwitchUserModel
                {
                    userId = await GetUseridByName(data.GiftedSubscription.DisplayName),
                    userName = data.GiftedSubscription.DisplayName,
                    isSub = data.GiftedSubscription.IsSubscriber,
                    isVip = vip,
                    isModer = data.GiftedSubscription.IsModerator,
                    giftsCount = badges[1],
                    subMounthsCount = badges[0],
                    SubPlan = GetSubTier(data.GiftedSubscription.MsgParamSubPlan.ToString()),
                    userType = data.GiftedSubscription.UserType.ToString()
                });

                return(user);
            }
            catch (Exception ex)
            {
                //logService.Add(ex, MessageType.Type.ERROR,
                //     MethodBase.GetCurrentMethod().DeclaringType);
                Console.WriteLine(ex.Message + "in " + MethodBase.GetCurrentMethod().DeclaringType);
                return(null);
            }
        }
Esempio n. 12
0
 private void OnCommunitySub(object sedner, OnCommunitySubscriptionArgs e)
 {
 }
Esempio n. 13
0
 private static void Client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
 {
     Console.WriteLine($"[{e.Channel}] Community Subscription.");
 }
Esempio n. 14
0
 private void _client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
 {
 }
Esempio n. 15
0
 public static void OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
 {
 }
Esempio n. 16
0
 /// <summary>
 /// Passes <see cref="OnCommunitySubscription"/> events down to subscribed plugins.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="OnCommunitySubscriptionArgs"/> object.</param>
 private void TwitchClient_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e) => this.OnCommunitySubscription?.Invoke(this, e);
 private void OnPrimeSub(object sender, OnCommunitySubscriptionArgs e)
 {
 }
Esempio n. 18
0
 private async void TwitchOnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e)
 {
     BotChannel bChan = await Program.Channels.GetTwitchChannelByName(e.Channel);
     await Program.BotEvents.RaiseTwitchOnCommunitySubscription(bChan, e.GiftedSubscription.SystemMsgParsed);
 }
Esempio n. 19
0
 private void Client_OnCommunitySubscription(object?sender, OnCommunitySubscriptionArgs e)
 {
     // TODO: Thank you message
 }