Ejemplo n.º 1
0
 public Task <SteamCommunityProfileModel> GetProfileAsync(ulong id)
 => _steam.GetCommunityProfileAsync(id);
Ejemplo n.º 2
0
        public async Task <SteamCommunityProfileModel> GetUserCommunityProfile(ulong userSteamId)
        {
            var response = await _user.GetCommunityProfileAsync(userSteamId);

            return(response);
        }
Ejemplo n.º 3
0
 public string getCustomURL(ulong steamID64)
 {
     return("" + steamInterface.GetCommunityProfileAsync(steamID64).Result.CustomURL);
 }
Ejemplo n.º 4
0
        public async Task <string> SteamCustomUrl(ulong steamId)
        {
            var response = await _steamUser.GetCommunityProfileAsync(steamId);

            return(response.CustomURL);
        }
Ejemplo n.º 5
0
        public async Task GetCommunityProfileAsync_Should_Succeed()
        {
            var response = await steamInterface.GetCommunityProfileAsync(76561198050013009);

            Assert.NotNull(response);
        }
Ejemplo n.º 6
0
        public async Task SteamUser(CommandContext ctx, string query)
        {
            if (string.IsNullOrWhiteSpace(query))
            {
                await BotServices.SendErrorEmbedAsync(ctx, ":warning: SteamID or Community URL are required! Try **.su criticalflaw**");
            }
            else
            {
                var service = new BotServices();
                var steam   = new SteamUser(service.GetAPIToken("steam"));
                SteamCommunityProfileModel             profile = null;
                ISteamWebResponse <PlayerSummaryModel> summary = null;
                try
                {
                    var decode = await steam.ResolveVanityUrlAsync(query);

                    profile = await steam.GetCommunityProfileAsync(decode.Data).ConfigureAwait(false);

                    summary = await steam.GetPlayerSummaryAsync(decode.Data).ConfigureAwait(false);
                }
                catch
                {
                    profile = await steam.GetCommunityProfileAsync(ulong.Parse(query)).ConfigureAwait(false);

                    summary = await steam.GetPlayerSummaryAsync(ulong.Parse(query)).ConfigureAwait(false);
                }
                finally
                {
                    if (profile != null && summary != null)
                    {
                        await ctx.TriggerTypingAsync();

                        var output = new DiscordEmbedBuilder()
                                     .WithTitle(summary.Data.Nickname);
                        if (summary.Data.ProfileVisibility == ProfileVisibility.Public)
                        {
                            output.WithThumbnailUrl(profile.AvatarFull.ToString());
                            output.WithColor(DiscordColor.MidnightBlue);
                            output.WithUrl($"http://steamcommunity.com/id/{profile.SteamID}/");
                            output.WithFooter($"Steam ID: {profile.SteamID}");
                            output.AddField("Member since",
                                            summary.Data.AccountCreatedDate.ToUniversalTime().ToString(CultureInfo.CurrentCulture), true);
                            if (!string.IsNullOrWhiteSpace(profile.Summary))
                            {
                                output.WithDescription(Regex.Replace(profile.Summary, "<[^>]*>", ""));
                            }
                            if (summary.Data.UserStatus != UserStatus.Offline)
                            {
                                output.AddField("Status:", summary.Data.UserStatus.ToString(), true);
                            }
                            else
                            {
                                output.AddField("Last seen:", summary.Data.LastLoggedOffDate.ToUniversalTime().ToString(CultureInfo.CurrentCulture), true);
                            }
                            output.AddField("VAC Banned?:", profile.IsVacBanned ? "YES" : "NO", true);
                            output.AddField("Trade Banned?:", profile.TradeBanState, true);
                            if (profile.InGameInfo != null)
                            {
                                output.AddField("In-Game:", $"[{profile.InGameInfo.GameName}]({profile.InGameInfo.GameLink})", true);
                                output.AddField("Game Server IP:", profile.InGameServerIP, true);
                                output.WithImageUrl(profile.InGameInfo.GameLogoSmall);
                            }
                        }
                        else
                        {
                            output.Description = "This profile is private...";
                        }
                        await ctx.RespondAsync(embed : output.Build());
                    }
                    else
                    {
                        await BotServices.SendErrorEmbedAsync(ctx, ":mag: No results found!");
                    }
                }
            }
        }