コード例 #1
0
ファイル: Commands.cs プロジェクト: Stanley1551/KomobotV2
            public async Task GetMounts(CommandContext ctx, string server, string name)
            {
                var client = await ConstructBlizzardCharClient(server, name, new Parameter("fields", "mounts", ParameterType.QueryString));

                var response = await client.ExecuteTaskAsync(new RestRequest());

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    CharInfoWithMountResponse resp = JsonConvert.DeserializeObject <CharInfoWithMountResponse>(response.Content);

                    int numberOfMounts = resp.mounts.numCollected;

                    await ctx.RespondAsync("Ejha! " + resp.name + " " + numberOfMounts + " mounttal rendelkezik!");

                    return;
                }
                await ctx.RespondAsync("Nocsak! Ilyen karaktert nem találni!");
            }
コード例 #2
0
ファイル: WoWService.cs プロジェクト: Stanley1551/KomobotV2
        public async Task <int> GetMounts(string realm, string charname)
        {
            var client = await ConstructBlizzardCharClient(realm, charname, new Parameter("fields", "mounts", ParameterType.QueryString));

            var response = await client.ExecuteTaskAsync(new RestRequest());

            if (response.StatusCode == HttpStatusCode.OK)
            {
                CharInfoWithMountResponse resp = JsonConvert.DeserializeObject <CharInfoWithMountResponse>(response.Content);

                int numberOfMounts = resp.mounts.numCollected;

                return(numberOfMounts);
            }
            else
            {
                throw new Exception("HttpStatusCode is not OK.");
            }
        }