Class DiscordAssets

java.lang.Object
net.dv8tion.jda.api.utils.DiscordAssets

public final class DiscordAssets extends Object
Utility class to retrieve an ImageProxy of most Discord assets.
  • Method Details

    • applicationIcon

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy applicationIcon(@Nonnull ImageFormat format, @Nonnull String applicationId, @Nullable String iconId)
      Returns an ImageProxy of an application's icon.
      This returns null if the icon ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      applicationId - The application ID
      iconId - The application's icon ID
      Returns:
      An ImageProxy of the application's icon, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the icon ID
    • applicationCover

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy applicationCover(@Nonnull ImageFormat format, @Nonnull String applicationId, @Nullable String coverId)
      Returns an ImageProxy of an application's cover.
      This returns null if the cover ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      applicationId - The application ID
      coverId - The application's cover ID
      Returns:
      An ImageProxy of the application's cover, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the cover ID
    • applicationTeamIcon

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy applicationTeamIcon(@Nonnull ImageFormat format, @Nonnull String teamId, @Nullable String iconId)
      Returns an ImageProxy of an application team's icon.
      This returns null if the icon ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      teamId - The team ID
      iconId - The team's icon ID
      Returns:
      An ImageProxy of the application team's icon, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the icon ID
    • channelIcon

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy channelIcon(@Nonnull ImageFormat format, @Nonnull String channelId, @Nullable String iconId)
      Returns an ImageProxy of a channel's icon.
      This returns null if the icon ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      channelId - The channel ID
      iconId - The team's icon ID
      Returns:
      An ImageProxy of the channel's icon, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the icon ID
    • customEmoji

      @Nonnull public static ImageProxy customEmoji(@Nonnull ImageFormat format, @Nonnull String id)
      Returns an ImageProxy of a custom emoji's icon.
      This returns null if the ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      id - The custom emoji's ID
      Returns:
      An ImageProxy of the custom emoji's icon, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the ID
    • guildIcon

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy guildIcon(@Nonnull ImageFormat format, @Nonnull String guildId, @Nullable String iconId)
      Returns an ImageProxy of a guild's icon.
      This returns null if the icon ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      guildId - The guild ID
      iconId - The guild's icon ID
      Returns:
      An ImageProxy of the guild's icon, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the icon ID
    • guildSplash

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy guildSplash(@Nonnull ImageFormat format, @Nonnull String guildId, @Nullable String splashId)
      Returns an ImageProxy of a guild's splash image.
      This returns null if the splash ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      guildId - The guild ID
      splashId - The guild's splash ID
      Returns:
      An ImageProxy of the guild's splash image, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the splash ID
    • guildBanner

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy guildBanner(@Nonnull ImageFormat format, @Nonnull String guildId, @Nullable String bannerId)
      Returns an ImageProxy of a guild's banner.
      This returns null if the banner ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      guildId - The guild ID
      bannerId - The guild's banner ID
      Returns:
      An ImageProxy of the guild's banner, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the banner ID
    • memberAvatar

      @Contract("_, _, _, null -> null; _, _, _, !null -> !null") public static ImageProxy memberAvatar(@Nonnull ImageFormat format, @Nonnull String guildId, @Nonnull String userId, @Nullable String avatarId)
      Returns an ImageProxy of a member's avatar.
      This returns null if the avatar ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      guildId - The guild ID
      userId - The user ID
      avatarId - The member's avatar ID
      Returns:
      An ImageProxy of the member's avatar, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the avatar ID
    • roleIcon

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy roleIcon(@Nonnull ImageFormat format, @Nonnull String roleId, @Nullable String iconId)
      Returns an ImageProxy of a role's icon.
      This returns null if the icon ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      roleId - The role ID
      iconId - The icon ID
      Returns:
      An ImageProxy of the roles's icon, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the icon ID
    • scheduledEventCoverImage

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy scheduledEventCoverImage(@Nonnull ImageFormat format, @Nonnull String eventId, @Nullable String imageId)
      Returns an ImageProxy of a scheduled event's cover image.
      This returns null if the avatar ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      eventId - The event ID
      imageId - The event's image ID
      Returns:
      An ImageProxy of the scheduled event's cover image, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the image ID
    • stickerPackBanner

      @Contract("_, null -> null; _, !null -> !null") public static ImageProxy stickerPackBanner(@Nonnull ImageFormat format, @Nullable String bannerId)
      Returns an ImageProxy of a sticker pack's banner.
      This returns null if the banner ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      bannerId - The sticker pack's banner ID
      Returns:
      An ImageProxy of the sticker pack's banner, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the banner ID
    • userAvatar

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy userAvatar(@Nonnull ImageFormat format, @Nonnull String userId, @Nullable String avatarId)
      Returns an ImageProxy of a user's avatar.
      This returns null if the avatar ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      userId - The user ID
      avatarId - The user's avatar ID
      Returns:
      An ImageProxy of the user's avatar, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the avatar ID
    • userBanner

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy userBanner(@Nonnull ImageFormat format, @Nonnull String userId, @Nullable String bannerId)
      Returns an ImageProxy of a user's banner.
      This returns null if the banner ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      userId - The user ID
      bannerId - The user's banner ID
      Returns:
      An ImageProxy of the user's banner, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the banner ID
    • userDefaultAvatar

      @Nonnull public static ImageProxy userDefaultAvatar(@Nonnull ImageFormat format, @Nonnull String avatarId)
      Returns an ImageProxy of a user's default avatar.

      At the time of writing, the only supported format is PNG.

      Size parameters are ignored by this endpoint.

      Parameters:
      avatarId - The user's default avatar ID
      Returns:
      An ImageProxy of the user's default avatar
      Throws:
      IllegalArgumentException - If an argument is null
    • userTagBadge

      @Contract("_, _, null -> null; _, _, !null -> !null") public static ImageProxy userTagBadge(@Nonnull ImageFormat format, @Nonnull String guildId, @Nullable String badgeId)
      Returns an ImageProxy of a user's tag badge.
      This returns null if the badge ID is null.

      At the time of writing, the supported formats are:

      Parameters:
      format - The image format to request the image as
      guildId - The guild ID
      badgeId - The badge ID
      Returns:
      An ImageProxy of the user's tag badge, or null
      Throws:
      IllegalArgumentException - If an argument is null, except for the badge ID