more logging

This commit is contained in:
defnotken
2025-11-11 11:04:39 -06:00
parent 44dc35ff99
commit 3b93ebb9e5

View File

@@ -56,7 +56,7 @@ public class LightlessModule : InteractionModuleBase
if (profileData != null)
{
_logger.LogWarning("Fetching profile image for UID: {uid}", uidToGet);
byte[] profileImage = await GetProfileImage(db, uid).ConfigureAwait(false);
byte[] profileImage = await GetProfileImage(profileData).ConfigureAwait(false);
_logger.LogWarning("Image in Bytes: {img}", profileImage);
MemoryStream ms = new(profileImage);
await using (ms.ConfigureAwait(false))
@@ -601,11 +601,12 @@ public class LightlessModule : InteractionModuleBase
}
return dbUser.UID;
}
private async Task<byte[]> GetProfileImage(LightlessDbContext db, string uid)
private async Task<byte[]> GetProfileImage(UserProfileData profile)
{
var profile = await db.UserProfileData.Where(u => u.UserUID == uid).SingleOrDefaultAsync().ConfigureAwait(false);
_logger.LogWarning("Fetching image: {img}", profile.Base64ProfileImage);
if (profile != null && profile.Base64ProfileImage != null && profile.Base64ProfileImage.Length > 0)
{
_logger.LogWarning("Fetching image complete");
return Convert.FromBase64String(profile.Base64ProfileImage);
}
return Array.Empty<byte>();