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); } } }
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); }
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); }
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"); } }
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); }
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); }
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); } }
private void OnCommunitySub(object sedner, OnCommunitySubscriptionArgs e) { }
private static void Client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e) { Console.WriteLine($"[{e.Channel}] Community Subscription."); }
private void _client_OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e) { }
public static void OnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e) { }
/// <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) { }
private async void TwitchOnCommunitySubscription(object sender, OnCommunitySubscriptionArgs e) { BotChannel bChan = await Program.Channels.GetTwitchChannelByName(e.Channel); await Program.BotEvents.RaiseTwitchOnCommunitySubscription(bChan, e.GiftedSubscription.SystemMsgParsed); }
private void Client_OnCommunitySubscription(object?sender, OnCommunitySubscriptionArgs e) { // TODO: Thank you message }