/// <summary> /// Returns the endpoint for a specific guild's icon. Format may be PNG, JPEG, or WebP. /// https://cdn.discordapp/icons/guild_id/guild_icon.format /// </summary> /// <param name="guildId">Unique ID of the guild. Obtain from <see cref="GuildDescriptor.Id"/></param> /// <param name="iconHash">Guild's hashed icon. Obtain from <see cref="GuildDescriptor.IconHash"/></param> /// <param name="format">CdnFormat PNG, JPEG, or WebP</param> /// <returns></returns> public static string GetGuildIconEndpoint(ulong guildId, string iconHash, CdnFormat format) { if (format == CdnFormat.gif) { throw new ArgumentException("Format must be PNG, JPEG, or WebP", nameof(format)); } return($"{CdnBaseUrl}{GuildIconEndpoint}{guildId}/{iconHash}.{format}"); }
/// <summary> /// Returns the endpoint for an application's icon. Format may be PNG, JPEG, or WebP. /// https://cdn.discordapp/app-icons/application_id/application_hash.format /// </summary> /// <param name="appId"></param> /// <param name="appHash"></param> /// <param name="format"></param> /// <returns></returns> public static string GetApplicationIconEndpoint(ulong appId, string appHash, CdnFormat format) { if (format == CdnFormat.gif) { throw new ArgumentException("Format must be PNG, JPEG, or WebP", nameof(format)); } return($"{CdnBaseUrl}{ApplicationIconEndpoint}{appId}/{appHash}.{format}"); }
/// <summary> /// Returns the endpoint for a specific emoji. Format may be gif or PNG. /// https://cdn.discordapp/emojis/emoji_id.format /// </summary> /// <param name="emojiId">Unique ID of the emoji. Obtain from <see cref="EmojiDescriptor.Id"/></param> /// <param name="format">Format of the emoji. May be gif or PNG</param> /// <returns></returns> public static string GetEmojiEndpoint(ulong emojiId, CdnFormat format) { if (format != CdnFormat.gif && format != CdnFormat.png) { throw new ArgumentException("Format must be gif or PNG", nameof(format)); } return($"{CdnBaseUrl}{EmojiEndpoint}{emojiId}.{format}"); }
/// <summary> /// Returns the endpoint for a user's avatar. Format may be PNG, JPEG, GIF, or WebP. /// https://cdn.discordapp/avatars/user_id/avatar_hash.format /// </summary> /// <param name="userId">Unique ID of the user. Obtain from <see cref="UserDescriptor.Id"/></param> /// <param name="avatarHash">User's hashed avatar. Obtain from <see cref="UserDescriptor.AvatarHash"/></param> /// <param name="format"></param> /// <returns></returns> public static string GetAvatarEndpoint(ulong userId, string avatarHash, CdnFormat format) { return($"{CdnBaseUrl}{UserAvatarEndpoint}{userId}/{avatarHash}.{format}"); }