private void Pubsub_OnChannelSubscription(object sender, TwitchLib.PubSub.Events.OnChannelSubscriptionArgs e) { string message = $"[EVENT] {e.Subscription.Username} just subscribed to the channel for {e.Subscription.Months}. time!"; Console.WriteLine(message); Discord.SendMessage(e.Subscription.ChannelName, message); }
private void OnChannelSubscription(object sender, TwitchLib.PubSub.Events.OnChannelSubscriptionArgs e) { // If the channelId is not the channel id we're trying to listen to in this class, don't continue. if (e.Subscription.ChannelId != _channelId) { return; } //todo not sure if recipientName is set or not when it's not a gifted sub. Debug.Log($"{e.Subscription.RecipientName} for {e.Subscription.Months} months in a row."); }
private void Pubsub_OnChannelSubscription(object sender, TwitchLib.PubSub.Events.OnChannelSubscriptionArgs e) { Logger.Instance.LogMessage(TracingLevel.INFO, $"Sub: {e.Subscription.DisplayName} {(e.Subscription.UserId != e.Subscription.RecipientId ? "gifted to " + e.Subscription.RecipientName : "")}"); // Send Chat Message if (!String.IsNullOrEmpty(global.SubChatMessage)) { TwitchChat.Instance.SendMessage(global.SubChatMessage.Replace(@"\n", "\n").Replace("{USERNAME}", e.Subscription.Username).Replace("{DISPLAYNAME}", e.Subscription.DisplayName).Replace("{RecipientName}", e.Subscription.RecipientName).Replace("{MESSAGE}", e.Subscription.SubMessage.Message).Replace("{MONTHS}", e.Subscription.Months.ToString())); } if (!String.IsNullOrEmpty(global.SubFlashMessage)) { TwitchChat.Instance.RaisePageAlert(global.SubFlashMessage.Replace("{USERNAME}", e.Subscription.Username).Replace("{DISPLAYNAME}", e.Subscription.DisplayName).Replace("{RecipientName}", e.Subscription.RecipientName).Replace("{MESSAGE}", e.Subscription.SubMessage.Message).Replace("{MONTHS}", e.Subscription.Months.ToString()), global.SubFlashColor); } }
private void Client_OnChannelSubscription(object sender, TwitchLib.PubSub.Events.OnChannelSubscriptionArgs e) { #if DEBUG Trace.WriteLine("Sub received!"); #endif try { SerialPortHelper.SendMessage(PortName, Alerts[1].Signal, Alerts[1].SignalType); EventHistory.TwitchEvents.Insert(0, new TwitchEvent(e.Subscription.Username, DateTime.Now, TwitchEventType.Sub)); } catch (Exception ex) { #if DEBUG Trace.WriteLine(ex.Message); #endif } }
private async void Pubsub_OnChannelSubscription(object sender, TwitchLib.PubSub.Events.OnChannelSubscriptionArgs e) { Logger.Instance.LogMessage(TracingLevel.INFO, $"Sub: {e.Subscription.DisplayName} {(e.Subscription.UserId != e.Subscription.RecipientId ? "gifted to " + e.Subscription.RecipientName : "")}"); // Check if channel is live var channelInfo = await TwitchChannelInfoManager.Instance.GetChannelInfo(channelName); if (channelInfo != null && !channelInfo.IsLive) { Logger.Instance.LogMessage(TracingLevel.INFO, $"Not raising On Sub because channel isn't live"); return; } // Send Chat Message if (!String.IsNullOrEmpty(global.SubChatMessage)) { TwitchChat.Instance.SendMessage(global.SubChatMessage.Replace(@"\n", "\n").Replace("{USERNAME}", e.Subscription.Username).Replace("{DISPLAYNAME}", e.Subscription.DisplayName).Replace("{RecipientName}", e.Subscription.RecipientName).Replace("{MESSAGE}", e.Subscription.SubMessage.Message).Replace("{MONTHS}", e.Subscription.Months.ToString())); } if (!String.IsNullOrEmpty(global.SubFlashMessage)) { TwitchChat.Instance.RaisePageAlert(e.Subscription.DisplayName, global.SubFlashMessage.Replace("{USERNAME}", e.Subscription.Username).Replace("{DISPLAYNAME}", e.Subscription.DisplayName).Replace("{RecipientName}", e.Subscription.RecipientName).Replace("{MESSAGE}", e.Subscription.SubMessage.Message).Replace("{MONTHS}", e.Subscription.Months.ToString()), global.SubFlashColor); } }
private void PubSubClient_OnChannelSubscription(object sender, TwitchLib.PubSub.Events.OnChannelSubscriptionArgs e) { Utilities.Log("PubSubClient_OnChannelSubscription " + e.Subscription.DisplayName); this.eventsManager?.OnNewSubscriberEvent(e); }