예제 #1
0
        public static Viewer FromTwitchDiscord(Bots.MessageType e, BotInstance BotInstance, string ID, ref bool CreatedViewer)
        {
            List <KeyValuePair <string, string> > Headers = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("CurrencyID", BotInstance.Currency.ID.ToString())
            };

            if (e == Bots.MessageType.Twitch)
            {
                Headers.Add(new KeyValuePair <string, string>("TwitchID", ID));
            }
            if (e == Bots.MessageType.Discord)
            {
                Headers.Add(new KeyValuePair <string, string>("DiscordID", ID));
            }
            ResponseObject RObj = WebRequests.PostRequest("viewer", Headers, true);

            CreatedViewer = RObj.Code == 200;
            RObj          = WebRequests.GetRequest("viewer", Headers);
            if (RObj.Code == 200)
            {
                Viewer B = FromJson(RObj.Data);
                return(B);
            }
            return(null);
        }
예제 #2
0
        public static List <Viewer> FromCurrency(BotInstance BotInstance)
        {
            List <KeyValuePair <string, string> > Headers = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("CurrencyID", BotInstance.Currency.ID.ToString())
            };
            ResponseObject RObj = WebRequests.GetRequest("viewer", Headers);

            if (RObj.Code == 200)
            {
                List <Viewer> B = new List <Viewer> {
                };
                foreach (Newtonsoft.Json.Linq.JToken Item in RObj.Data)
                {
                    B.Add(Item.ToObject <Viewer>());
                }
                return(B);
            }
            return(null);
        }