예제 #1
0
        public async Task ProfileCommand([Optional] IUser User)
        {
            if (User == null)
            {
                User = Context.User;
            }

            IGuildUser GuildUser = await DiscordSocketClient.Rest.GetGuildUserAsync(Context.Guild.Id, User.Id);

            DateTimeOffset Joined = UserRecordsService.GetUserJoin(GuildUser);

            UserProfile Profile = ProfilesDB.Profiles.Find(User.Id);

            string[] LastNicknames = GetLastNameRecords(UserRecordsService.GetNameRecords(User, NameType.Nickname), 5);
            string[] LastUsernames = GetLastNameRecords(UserRecordsService.GetNameRecords(User, NameType.Username), 5);

            await BuildEmbed(EmojiEnum.Unknown)
            .WithTitle($"User Profile For {GuildUser.Username}#{GuildUser.Discriminator}")
            .WithThumbnailUrl(GuildUser.GetTrueAvatarUrl())
            .AddField("Username", GuildUser.GetUserInformation(), true)
            .AddField(!string.IsNullOrEmpty(GuildUser.Nickname), "Nickname", GuildUser.Nickname, true)
            .AddField("Created", $"{GuildUser.CreatedAt:MM/dd/yyyy HH:mm:ss} ({(DateTime.Now - GuildUser.CreatedAt.DateTime).Humanize(2, maxUnit: TimeUnit.Year)} ago)")
            .AddField(Joined != default, "Joined", $"{Joined:MM/dd/yyyy HH:mm:ss} ({DateTimeOffset.Now.Subtract(Joined).Humanize(2, maxUnit: TimeUnit.Year)} ago)")
            .AddField(Profile != null && Profile.BorkdayTime != default, "Last Birthday", new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Profile != null ? Profile.BorkdayTime : 0).ToLongDateString())
            .AddField("Top Role", Context.Guild.Roles.Where(Role => Role.Position == Context.Guild.GetUser(User.Id).Hierarchy).FirstOrDefault().Name)
            .AddField(LastNicknames.Length > 1, $"Last {LastNicknames.Length} Nicknames:", string.Join(", ", LastNicknames))
            .AddField(LastUsernames.Length > 1, $"Last {LastUsernames.Length} Usernames:", string.Join(", ", LastUsernames))
            .SendEmbed(Context.Channel);
        }
예제 #2
0
        private async Task RunNamesCommands(IUser User, NameType NameType)
        {
            if (User == null)
            {
                User = Context.User;
            }

            List <NameRecord> Names = UserRecordsService.GetNameRecords(User, NameType).ToList();

            Names.Sort((a, b) => b.SetTime.CompareTo(a.SetTime));

            EmbedBuilder[] Menu = BuildNicknameEmbeds(Names.ToArray(), $"{NameType} Record for User {User.Username}#{User.Discriminator}");

            if (Menu.Length == 1)
            {
                await Menu[0].SendEmbed(Context.Channel);
            }
            else
            {
                await CreateReactionMenu(Menu, Context.Channel);
            }
        }