public async Task Profile(SocketGuildUser user) { //Check to see if the user requested to view the profile of is a bot if (user.IsBot) { await Context.Channel.SendMessageAsync("You can not get a profile of a bot!"); return; } //This will get the user's main role IReadOnlyCollection <SocketRole> roles = user.Roles; List <SocketRole> sortedRoles = roles.OrderByDescending(o => o.Position).ToList(); SocketRole userMainRole = sortedRoles.First(); //Get the user's account and server data relating to the user UserAccount account = UserAccountsManager.GetAccount(user); UserAccountServerData accountServer = account.GetOrCreateServer(Context.Guild.Id); EmbedBuilder embed = new EmbedBuilder(); string warningText = "No :sunglasses:"; if (!accountServer.IsAccountNotWarnable && !user.GuildPermissions.Administrator) { warningText = $"Yes\n**Warnings: ** {accountServer.Warnings}"; } embed.WithCurrentTimestamp(); embed.WithThumbnailUrl(user.GetAvatarUrl()); embed.WithTitle(user.Username + "'s Profile"); embed.AddField("Stats", $"**Level: ** {account.LevelNumber}\n**Xp: ** {account.Xp}\n", true); embed.AddField("Server", $"**Points: **{accountServer.Points}\n**Warnable: **{warningText}\n**Main Role: **{userMainRole.Name}\n", true); embed.AddField("Account", $"**Id: **{account.Id}\n**Creation Date: **{user.CreatedAt}"); embed.WithColor(userMainRole.Color); embed.WithFooter(account.ProfileMsg, user.GetAvatarUrl()); string description = ""; if (user.Id == Global.BotOwner.Id) { description += $":crown: {Global.BotName} owner!\n"; } if (HighLevelProfileMessageManager.GetHighLevelProfileMessage(user.Id) != null) { description += HighLevelProfileMessageManager.GetHighLevelProfileMessage(user.Id).Message; } embed.WithDescription(description); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
public async Task AddCustomProfileMessage(SocketUser user, [Remainder] string message) { if (HighLevelProfileMessageManager.GetHighLevelProfileMessage(user.Id) != null) { await Context.Channel.SendMessageAsync("That user already has a custom high level profile message!"); return; } HighLevelProfileMessageManager.AddCustomHighLevelProfileMessage(user.Id, message); await Context.Channel.SendMessageAsync( $"**{user.Username}** now has a custom high level profile message of '{message}'."); }
public async Task RemoveCustomProfileMessage([Remainder] SocketUser user) { if (HighLevelProfileMessageManager.GetHighLevelProfileMessage(user.Id) == null) { await Context.Channel.SendMessageAsync( "That user already doesn't have a custom high level profile message!"); return; } HighLevelProfileMessageManager.HighLevelProfileMessages.Remove( HighLevelProfileMessageManager.GetHighLevelProfileMessage(user.Id)); HighLevelProfileMessageManager.SaveHighLevelProfileMessages(); await Context.Channel.SendMessageAsync( $"**{user.Username}** custom high level profile message was removed."); }