Skip to content

Commit

Permalink
Update ImageUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
WinG4merBR committed Jan 5, 2025
1 parent 3f600c4 commit ff59284
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object ImageUtils {
}
}

suspend fun loadImageFromURL(url: String): BufferedImage {
suspend fun loadProfileAssetFromURL(url: String): BufferedImage {
return withContext(Dispatchers.IO) {
try {
ProfileCacheManager.imageCache.get(url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ProfileRender(
}

val userAboutMe =
ProfileUtils.formatAboutMe(userData.userProfile.aboutme ?: context.locale["profile.defaultAbouMe"], layout)
ProfileUtils.formatAboutMe(userData.userProfile.aboutme ?: context.locale["profile.defaultAboutMe"], layout)

graphics.drawTextWithFont(config.profileWidth, config.profileHeight) {
text = userAboutMe
Expand All @@ -137,12 +137,12 @@ class ProfileRender(
val avatarDeferred = async {
val avatarUrl = user.avatarUrl ?: user.defaultAvatarUrl
val avatarWithSize = avatarUrl.plus("?size=1024")
ImageUtils.loadImageFromURL(avatarWithSize)
ImageUtils.loadProfileAssetFromURL(avatarWithSize)
}

val decorationDeferred = async {
data.userProfile.decoration?.let {
ImageUtils.loadImageFromURL(Constants.PROFILE_DECORATION(it))
ImageUtils.loadProfileAssetFromURL(Constants.PROFILE_DECORATION(it))
}
}

Expand Down Expand Up @@ -181,7 +181,7 @@ class ProfileRender(

private suspend fun drawDecoration(data: FoxyUser, layoutInfo: Layout) {
data.userProfile.decoration?.let {
val decorationImage = ImageUtils.loadImageFromURL(Constants.PROFILE_DECORATION(it))
val decorationImage = ImageUtils.loadProfileAssetFromURL(Constants.PROFILE_DECORATION(it))
graphics.drawImage(
decorationImage,
(config.profileWidth / layoutInfo.profileSettings.positions.decorationPosition.x).toInt(),
Expand Down Expand Up @@ -218,7 +218,7 @@ class ProfileRender(
var y = layoutInfo.profileSettings.positions.badgesPosition.y

for (badge in userBadges) {
val badgeImage = ImageUtils.loadImageFromURL(Constants.PROFILE_BADGES(badge.asset))
val badgeImage = ImageUtils.loadProfileAssetFromURL(Constants.PROFILE_BADGES(badge.asset))
graphics.drawImage(badgeImage, x.toInt(), y.toInt(), 50, 50, null)

x += 60
Expand All @@ -231,7 +231,7 @@ class ProfileRender(

private suspend fun drawMarryInfo(userData: FoxyUser, layout: Layout) {
val marriedDateFormatted = context.utils.convertToHumanReadableDate(userData.marryStatus.marriedDate!!)
val marriedOverlay = ImageUtils.loadImageFromURL(Constants.MARRIED_OVERLAY(layout.id))
val marriedOverlay = ImageUtils.loadProfileAssetFromURL(Constants.MARRIED_OVERLAY(layout.id))
val color = if (layout.darkText) Color.BLACK else Color.WHITE
val partnerUser = context.jda.retrieveUserById(userData.marryStatus.marriedWith!!).await()

Expand Down

0 comments on commit ff59284

Please sign in to comment.