Class ImageUrl
- Namespace
- NetCord
- Assembly
- NetCord.dll
Represents a URL to an image hosted by Discord.
public class ImageUrl : ISpanFormattable, IFormattable
- Inheritance
-
ImageUrl
- Implements
- Inherited Members
Properties
SupportsSize
Indicates whether this ImageUrl supports a size query parameter.
public bool SupportsSize { get; }
Property Value
Methods
AchievementIcon(ulong, ulong, string, ImageFormat)
Gets the ImageUrl of an achievement icon.
public static ImageUrl AchievementIcon(ulong applicationId, ulong achievementId, string iconHash, ImageFormat format)
Parameters
applicationIdulongThe ID of the application.
achievementIdulongThe ID of the achievement.
iconHashstringThe achievement's icon hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
ApplicationAsset(ulong, ulong, ImageFormat)
Gets the ImageUrl of an application asset.
public static ImageUrl ApplicationAsset(ulong applicationId, ulong assetId, ImageFormat format)
Parameters
applicationIdulongThe ID of the application.
assetIdulongThe ID of the asset.
formatImageFormatThe format of the returned ImageUrl.
Returns
ApplicationCover(ulong, string, ImageFormat)
Gets the ImageUrl of an application's cover image.
public static ImageUrl ApplicationCover(ulong applicationId, string coverHash, ImageFormat format)
Parameters
applicationIdulongThe ID of the application.
coverHashstringThe application's cover image hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
ApplicationIcon(ulong, string, ImageFormat)
Gets the ImageUrl of an application's icon.
public static ImageUrl ApplicationIcon(ulong applicationId, string iconHash, ImageFormat format)
Parameters
applicationIdulongThe ID of the application.
iconHashstringThe application's icon hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
AvatarDecoration(string)
Gets the ImageUrl of an avatar decoration.
public static ImageUrl AvatarDecoration(string avatarDecorationHash)
Parameters
avatarDecorationHashstringThe avatar decoration data asset hash.
Returns
CustomEmoji(ulong, ImageFormat)
Gets the ImageUrl of a custom emoji.
public static ImageUrl CustomEmoji(ulong emojiId, ImageFormat format)
Parameters
emojiIdulongThe ID of the emoji.
formatImageFormatThe format of the returned ImageUrl.
Returns
DefaultUserAvatar(ushort)
Gets the ImageUrl of the default user avatar for users on the legacy username system.
public static ImageUrl DefaultUserAvatar(ushort discriminator)
Parameters
discriminatorushortThe user's discriminator.
Returns
Remarks
This ImageUrl does not support setting size.
DefaultUserAvatar(ulong)
Gets the ImageUrl of the default user avatar for users on the new username system.
public static ImageUrl DefaultUserAvatar(ulong id)
Parameters
idulongThe user's ID.
Returns
Remarks
This ImageUrl does not support setting size.
GuildBanner(ulong, string, ImageFormat?)
Gets the ImageUrl of a guild's banner.
public static ImageUrl GuildBanner(ulong guildId, string bannerHash, ImageFormat? format)
Parameters
guildIdulongThe ID of the guild.
bannerHashstringThe guild's banner hash.
formatImageFormat?The format of the returned ImageUrl. Defaults to Png (or Gif for animated banners).
Returns
GuildDiscoverySplash(ulong, string, ImageFormat)
Gets the ImageUrl of a guild's discovery splash.
public static ImageUrl GuildDiscoverySplash(ulong guildId, string discoverySplashHash, ImageFormat format)
Parameters
guildIdulongThe ID of the guild.
discoverySplashHashstringThe guild's discovery splash hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
GuildIcon(ulong, string, ImageFormat?)
Gets the ImageUrl of a guild's icon.
public static ImageUrl GuildIcon(ulong guildId, string iconHash, ImageFormat? format)
Parameters
guildIdulongThe ID of the guild.
iconHashstringThe guild's icon hash.
formatImageFormat?The format of the returned ImageUrl. Defaults to Png (or Gif for animated icons).
Returns
GuildScheduledEventCover(ulong, string, ImageFormat)
Gets the ImageUrl of a guild scheduled event's cover image.
public static ImageUrl GuildScheduledEventCover(ulong scheduledEventId, string coverImageHash, ImageFormat format)
Parameters
scheduledEventIdulongThe ID of the scheduled event.
coverImageHashstringThe scheduled event's cover image hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
GuildSplash(ulong, string, ImageFormat)
Gets the ImageUrl of a guild's splash.
public static ImageUrl GuildSplash(ulong guildId, string splashHash, ImageFormat format)
Parameters
guildIdulongThe ID of the guild.
splashHashstringThe guild's splash hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
GuildTagBadge(ulong, string, ImageFormat)
Gets the ImageUrl of a guild tag badge.
public static ImageUrl GuildTagBadge(ulong guildId, string badgeHash, ImageFormat format)
Parameters
guildIdulongThe ID of the guild.
badgeHashstringThe guild tag badge hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
GuildUserAvatar(ulong, ulong, string, ImageFormat?)
Gets the ImageUrl of a guild user's avatar.
public static ImageUrl GuildUserAvatar(ulong guildId, ulong userId, string avatarHash, ImageFormat? format)
Parameters
guildIdulongThe ID of the guild.
userIdulongThe ID of the user.
avatarHashstringThe user's avatar hash.
formatImageFormat?The format of the returned ImageUrl. Defaults to Png (or Gif for animated avatars).
Returns
GuildUserBanner(ulong, ulong, string, ImageFormat?)
Gets the ImageUrl of a guild user's banner.
public static ImageUrl GuildUserBanner(ulong guildId, ulong userId, string bannerHash, ImageFormat? format)
Parameters
guildIdulongThe ID of the guild.
userIdulongThe ID of the user.
bannerHashstringThe user's banner hash.
formatImageFormat?The format of the returned ImageUrl. Defaults to Png (or Gif for animated banners).
Returns
GuildWidget(ulong, GuildWidgetStyle?, string, ApiVersion?)
Gets the ImageUrl of a guild widget.
public static ImageUrl GuildWidget(ulong guildId, GuildWidgetStyle? style = null, string hostname = "discord.com", ApiVersion? version = null)
Parameters
guildIdulongThe ID of the guild.
styleGuildWidgetStyle?The style of the widget. If null, uses the default style.
hostnamestringThe hostname to use for the API request.
versionApiVersion?The API version to use.
Returns
Remarks
This ImageUrl does not support setting size.
RoleIcon(ulong, string, ImageFormat)
Gets the ImageUrl of a role's icon.
public static ImageUrl RoleIcon(ulong roleId, string iconHash, ImageFormat format)
Parameters
roleIdulongThe ID of the role.
iconHashstringThe role's icon hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
Sticker(ulong, StickerFormat, ImageFormat)
Gets the ImageUrl of a sticker.
public static ImageUrl Sticker(ulong stickerId, StickerFormat stickerFormat, ImageFormat format)
Parameters
stickerIdulongThe ID of the sticker.
stickerFormatStickerFormatThe format of the sticker.
formatImageFormatThe format of the returned ImageUrl.
Returns
Remarks
This ImageUrl does not support setting size. Sticker GIFs use the media URL instead of the CDN URL.
StickerPackBanner(ulong, ImageFormat)
Gets the ImageUrl of a sticker pack banner.
public static ImageUrl StickerPackBanner(ulong stickerPackBannerAssetId, ImageFormat format)
Parameters
stickerPackBannerAssetIdulongThe ID of the sticker pack banner asset.
formatImageFormatThe format of the returned ImageUrl.
Returns
StorePageAsset(ulong, ulong, ImageFormat)
Gets the ImageUrl of a store page asset.
public static ImageUrl StorePageAsset(ulong applicationId, ulong assetId, ImageFormat format)
Parameters
applicationIdulongThe ID of the application.
assetIdulongThe ID of the asset.
formatImageFormatThe format of the returned ImageUrl.
Returns
TeamIcon(ulong, string, ImageFormat)
Gets the ImageUrl of a team's icon.
public static ImageUrl TeamIcon(ulong teamId, string iconHash, ImageFormat format)
Parameters
teamIdulongThe ID of the team.
iconHashstringThe team's icon hash.
formatImageFormatThe format of the returned ImageUrl.
Returns
ToString()
public override string ToString()
Returns
ToString(int)
Returns the ImageUrl with a specified size.
public virtual string ToString(int size)
Parameters
sizeintThe desired size of the image. Can be any power of two between 16 and 4096.
Returns
ToString(string?, IFormatProvider?)
Formats the value of the current ImageUrl using the specified format.
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format to use. If null or empty, returns the URL without size parameter. Otherwise, should be a numeric string representing the desired size.
formatProviderIFormatProviderThe provider to use to format the value. This parameter is ignored.
Returns
TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)
Tries to format the value of the current ImageUrl into the provided span of characters.
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
Parameters
destinationSpan<char>The span in which to write the formatted value.
charsWrittenintWhen this method returns, contains the number of characters that were written in
destination.formatReadOnlySpan<char>A span containing the format string. If empty, returns the URL without size parameter. Otherwise, should contain numeric characters representing the desired size.
providerIFormatProviderThe provider to use to format the value. This parameter is ignored.
Returns
UserAvatar(ulong, string, ImageFormat?)
Gets the ImageUrl of a user's avatar.
public static ImageUrl UserAvatar(ulong userId, string avatarHash, ImageFormat? format)
Parameters
userIdulongThe ID of the user.
avatarHashstringThe user's avatar hash.
formatImageFormat?The format of the returned ImageUrl. Defaults to Png (or Gif for animated avatars).
Returns
UserBanner(ulong, string, ImageFormat?)
Gets the ImageUrl of a user's banner.
public static ImageUrl UserBanner(ulong userId, string bannerHash, ImageFormat? format)
Parameters
userIdulongThe ID of the user.
bannerHashstringThe user's banner hash.
formatImageFormat?The format of the returned ImageUrl. Defaults to Png (or Gif for animated banners).