コード例 #1
0
        protected override void OnSocketMessage(string s, JObject obj)
        {
            switch (s)
            {
            case "action":
                BaseDataHandler.OnTwitchExtension((string)obj["user"], (int)obj["bits"], (string)obj["action"], obj["settings"]);
                break;

            case "cp_action":
                BaseDataHandler.OnTwitchChannelPoints((string)obj["user"], (string)obj["id"]);
                break;
            }
        }
コード例 #2
0
        protected override void OnSocketMessage(string s, string args)
        {
            var data = JObject.Parse(args);

            switch (s)
            {
            case "action":
                BaseDataHandler.OnTwitchExtension((string)data["user"], (int)data["bits"], (string)data["action"], data["settings"]);
                break;

            case "cp_action":
                BaseDataHandler.OnTwitchChannelPoints((string)data["user"], (string)data["id"]);
                break;
            }
        }
コード例 #3
0
 protected SocketData(BaseDataHandler baseDataHandler, IDataPlugin plugin)
 {
     BaseDataHandler = baseDataHandler;
     _plugin         = plugin;
 }
コード例 #4
0
 public TwitchExtensionData(BaseDataHandler baseDataHandler, IDataPlugin plugin) : base(baseDataHandler, plugin)
 {
 }
コード例 #5
0
 public TwitchExtensionData(BaseDataHandler baseDataHandler)
 {
     _baseDataHandler = baseDataHandler;
 }
コード例 #6
0
 public StreamlabsData(BaseDataHandler baseDataHandler)
 {
     _baseDataHandler = baseDataHandler;
 }
コード例 #7
0
        protected override void OnSocketMessage(string s, JObject obj)
        {
            var type    = (string)obj["type"];
            var account = (string)obj["for"];

            if (!obj.ContainsKey("message") || obj["message"].Type != JTokenType.Array)
            {
                return;
            }
            foreach (var message in obj["message"])
            {
                var name = (string)message["name"];
                switch (type)
                {
                case "donation":
                {
                    name = (string)message["from"];
                    var amount    = (int)double.Parse((string)message["amount"]);
                    var formatted = (string)message["formatted_amount"];

                    BaseDataHandler.OnDonation(name, amount, formatted);
                    break;
                }

                case "subscription":
                {
                    var months = (int)message["months"];
                    switch (account)
                    {
                    case "twitch_account":
                    {
                        var tier = (string)message["sub_plan"];
                        BaseDataHandler.OnTwitchSubscription(name, months, tier, false);
                        break;
                    }

                    case "youtube_account":
                        BaseDataHandler.OnYoutubeSponsor(name, months);
                        break;

                    case "mixer_account":
                        BaseDataHandler.OnMixerSubscription(name, months);
                        break;
                    }

                    break;
                }

                case "resub":
                {
                    var months = (int)message["months"];
                    switch (account)
                    {
                    case "twitch_account":
                    {
                        var tier = (string)message["sub_plan"];
                        BaseDataHandler.OnTwitchSubscription(name, months, tier, true);
                        break;
                    }

                    case "youtube_account":
                        BaseDataHandler.OnYoutubeSponsor(name, months);
                        break;

                    case "mixer_account":
                        BaseDataHandler.OnMixerSubscription(name, months);
                        break;
                    }

                    break;
                }

                case "follow" when account == "twitch_account":
                    BaseDataHandler.OnTwitchFollow(name);
                    break;

                case "follow" when account == "youtube_account":
                    BaseDataHandler.OnYoutubeSubscription(name);
                    break;

                case "follow" when account == "mixer_account":
                {
                    BaseDataHandler.OnMixerFollow(name);
                    break;
                }

                case "host":
                {
                    var viewers = int.Parse((string)message["viewers"]);
                    switch (account)
                    {
                    case "twitch_account":
                        BaseDataHandler.OnTwitchHost(name, viewers);
                        break;

                    case "mixer_account":
                        BaseDataHandler.OnMixerHost(name, viewers);
                        break;
                    }

                    break;
                }

                case "bits":
                {
                    var amount = int.Parse((string)message["amount"]);
                    BaseDataHandler.OnTwitchBits(name, amount);
                    break;
                }

                case "raid":
                {
                    var amount = (int)message["raiders"];
                    BaseDataHandler.OnTwitchRaid(name, amount);
                    break;
                }

                case "superchat":
                {
                    var amount    = int.Parse((string)message["amount"]);
                    var formatted = (string)message["displayString"];
                    BaseDataHandler.OnYoutubeSuperchat(name, amount, formatted);
                    break;
                }
                }
            }
        }
コード例 #8
0
 public StreamlabsData(BaseDataHandler baseDataHandler, IDataPlugin plugin) : base(baseDataHandler, plugin)
 {
 }