예제 #1
0
        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.");
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
파일: QTCore.cs 프로젝트: dbqt/QTBot
 private void PubSubClient_OnChannelSubscription(object sender, TwitchLib.PubSub.Events.OnChannelSubscriptionArgs e)
 {
     Utilities.Log("PubSubClient_OnChannelSubscription " + e.Subscription.DisplayName);
     this.eventsManager?.OnNewSubscriberEvent(e);
 }