diff --git a/LightlessSyncServer/LightlessSyncServices/Discord/MareModule.cs b/LightlessSyncServer/LightlessSyncServices/Discord/MareModule.cs index 0323888..146afa2 100644 --- a/LightlessSyncServer/LightlessSyncServices/Discord/MareModule.cs +++ b/LightlessSyncServer/LightlessSyncServices/Discord/MareModule.cs @@ -59,6 +59,30 @@ public class LightlessModule : InteractionModuleBase } } + [SlashCommand("groupinfo", "Shows you your group profile information")] + public async Task GroupInfo([Summary("gid", "ADMIN ONLY: GID to check for")] string? uid = null) + { + _logger.LogInformation("SlashCommand:{userId}:{Method}", + Context.Interaction.User.Id, nameof(GroupInfo)); + + try + { + EmbedBuilder eb = new(); + + //eb = await HandleUserInfo(eb, Context.User.Id, secondaryUid, discordUser?.Id ?? null, uid); + + await RespondAsync(embeds: new[] { eb.Build() }, ephemeral: true).ConfigureAwait(false); + } + catch (Exception ex) + { + EmbedBuilder eb = new(); + eb.WithTitle("An error occured"); + eb.WithDescription("Please report this error to bug-reports: " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine); + + await RespondAsync(embeds: new Embed[] { eb.Build() }, ephemeral: true).ConfigureAwait(false); + } + } + [SlashCommand("useradd", "ADMIN ONLY: add a user unconditionally to the Database")] public async Task UserAdd([Summary("desired_uid", "Desired UID")] string desiredUid) { @@ -463,6 +487,7 @@ public class LightlessModule : InteractionModuleBase var auth = await db.Auth.Include(u => u.PrimaryUser).SingleOrDefaultAsync(u => u.UserUID == dbUser.UID).ConfigureAwait(false); var groups = await db.Groups.Where(g => g.OwnerUID == dbUser.UID).ToListAsync().ConfigureAwait(false); var groupsJoined = await db.GroupPairs.Where(g => g.GroupUserUID == dbUser.UID).ToListAsync().ConfigureAwait(false); + var profile = await db.UserProfileData.Where(u => u.UserUID == dbUser.UID).SingleOrDefaultAsync().ConfigureAwait(false); var identity = await _connectionMultiplexer.GetDatabase().StringGetAsync("UID:" + dbUser.UID).ConfigureAwait(false); eb.WithTitle("User Information"); @@ -485,6 +510,14 @@ public class LightlessModule : InteractionModuleBase eb.AddField("Secondary UIDs", string.Join(Environment.NewLine, secondaryUIDs)); } } + if(profile != null) + { + eb.AddField("Profile Description", string.IsNullOrEmpty(profile.UserDescription) ? "(No description set)" : profile.UserDescription); + eb.AddField("Profile NSFW", profile.IsNSFW); + eb.AddField("Profile Disabled", profile.ProfileDisabled); + eb.AddField("Profile Flagged for Report", profile.FlaggedForReport); + eb.AddField("Profile Tags", profile.Tags != null && profile.Tags.Length > 0 ? string.Join(", ", profile.Tags) : "(No tags set)"); + } eb.AddField("Last Online (UTC)", dbUser.LastLoggedIn.ToString("U")); eb.AddField("Currently online ", !string.IsNullOrEmpty(identity)); eb.AddField("Hashed Secret Key", auth.HashedKey);