예제 #1
0
                public async Task <RuntimeResult> SetSteamAsync([Remainder] string username)
                {
                    ulong id = await SteamService.GetIdFromVanityAsync(username).ConfigureAwait(false);

                    var record = await UserRepository.GetOrCreateGameAsync(Context.User).ConfigureAwait(false);

                    record.SteamId = id;
                    await UserRepository.SaveRepositoryAsync().ConfigureAwait(false);

                    return(CommandRuntimeResult.FromSuccess(
                               $"Successfully set steam to {Format.Bold((await SteamService.GetProfileAsync(id).ConfigureAwait(false))?.CustomURL ?? id.ToString())}"));
                }
예제 #2
0
                public async Task <RuntimeResult> CheckSteamAsync(SocketUser user = null)
                {
                    var targetUser = user ?? Context.User;
                    var record     = UserRepository.GetGame(targetUser);

                    if (record == null || record.SteamId == 0)
                    {
                        return(CommandRuntimeResult.FromError("User hasn't setup their steam profile yet!"));
                    }

                    var profile = await SteamService.GetProfileAsync(record.SteamId).ConfigureAwait(false);

                    var builder = new EmbedBuilder
                    {
                        Author = new EmbedAuthorBuilder
                        {
                            Name    = profile.CustomURL ?? profile.SteamID.ToString(),
                            IconUrl = profile.Avatar.AbsoluteUri
                        },
                        Description = profile.Summary,
                        Footer      = new EmbedFooterBuilder
                        {
                            Text =
                                $"Recently Played: {string.Join(", ", profile.MostPlayedGames.Select(x => x.Name))}"
                        },
                        Color = ColorHelper.GetRandomColor()
                    }
                    .AddField("State:", profile.StateMessage, true)
                    .AddField("Member Since:", profile.MemberSince, true)
                    .AddField("Location:",
                              string.IsNullOrWhiteSpace(profile.Location) ? "Not Specified." : profile.Location, true)
                    .AddField("Real Name:",
                              string.IsNullOrWhiteSpace(profile.RealName) ? "Not Specified." : profile.RealName, true)
                    .AddField("VAC Banned?:", profile.IsVacBanned ? "Yes." : "No.", true);

                    await ReplyAsync("", embed : builder.Build()).ConfigureAwait(false);

                    return(CommandRuntimeResult.FromSuccess());
                }