* Add Lottie to enum ImageFormat * Allow image format and size to be specified * Deprecate URL properties * Use string.Empty in class CDNpull/1906/head
@@ -12,23 +12,35 @@ namespace Discord | |||
/// </summary> | |||
/// <param name="teamId">The team identifier.</param> | |||
/// <param name="iconId">The icon identifier.</param> | |||
/// <param name="size">The size of the image to return in horizontal pixels. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the team's icon. | |||
/// </returns> | |||
public static string GetTeamIconUrl(ulong teamId, string iconId) | |||
=> iconId != null ? $"{DiscordConfig.CDNUrl}team-icons/{teamId}/{iconId}.jpg" : null; | |||
public static string GetTeamIconUrl(ulong teamId, string iconId, ushort size, ImageFormat format) | |||
{ | |||
if (iconId == null) | |||
return null; | |||
string extension = FormatToExtension(format, string.Empty); | |||
return $"{DiscordConfig.CDNUrl}team-icons/{teamId}/{iconId}.{extension}?size={size}"; | |||
} | |||
/// <summary> | |||
/// Returns an application icon URL. | |||
/// </summary> | |||
/// <param name="appId">The application identifier.</param> | |||
/// <param name="iconId">The icon identifier.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the application's icon. | |||
/// </returns> | |||
public static string GetApplicationIconUrl(ulong appId, string iconId) | |||
=> iconId != null ? $"{DiscordConfig.CDNUrl}app-icons/{appId}/{iconId}.jpg" : null; | |||
public static string GetApplicationIconUrl(ulong appId, string iconId, ushort size, ImageFormat format) | |||
{ | |||
if (iconId == null) | |||
return null; | |||
string extension = FormatToExtension(format, string.Empty); | |||
return $"{DiscordConfig.CDNUrl}app-icons/{appId}/{iconId}.{extension}?size={size}"; | |||
} | |||
/// <summary> | |||
/// Returns a user avatar URL. | |||
/// </summary> | |||
@@ -62,67 +74,101 @@ namespace Discord | |||
/// </summary> | |||
/// <param name="guildId">The guild snowflake identifier.</param> | |||
/// <param name="iconId">The icon identifier.</param> | |||
/// <param name="size">The size of the image to return in horizontal pixels. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the guild's icon. | |||
/// </returns> | |||
public static string GetGuildIconUrl(ulong guildId, string iconId) | |||
=> iconId != null ? $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.jpg" : null; | |||
public static string GetGuildIconUrl(ulong guildId, string iconId, ushort size, ImageFormat format) | |||
{ | |||
if (iconId == null) | |||
return null; | |||
string extension = FormatToExtension(format, iconId); | |||
return $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.{extension}?size={size}"; | |||
} | |||
/// <summary> | |||
/// Returns a guild splash URL. | |||
/// </summary> | |||
/// <param name="guildId">The guild snowflake identifier.</param> | |||
/// <param name="splashId">The splash icon identifier.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the guild's splash. | |||
/// </returns> | |||
public static string GetGuildSplashUrl(ulong guildId, string splashId) | |||
=> splashId != null ? $"{DiscordConfig.CDNUrl}splashes/{guildId}/{splashId}.jpg" : null; | |||
public static string GetGuildSplashUrl(ulong guildId, string splashId, ushort size, ImageFormat format) | |||
{ | |||
if (splashId == null) | |||
return null; | |||
string extension = FormatToExtension(format, string.Empty); | |||
return $"{DiscordConfig.CDNUrl}splashes/{guildId}/{splashId}.{extension}?size={size}"; | |||
} | |||
/// <summary> | |||
/// Returns a guild discovery splash URL. | |||
/// </summary> | |||
/// <param name="guildId">The guild snowflake identifier.</param> | |||
/// <param name="discoverySplashId">The discovery splash icon identifier.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the guild's discovery splash. | |||
/// </returns> | |||
public static string GetGuildDiscoverySplashUrl(ulong guildId, string discoverySplashId) | |||
=> discoverySplashId != null ? $"{DiscordConfig.CDNUrl}discovery-splashes/{guildId}/{discoverySplashId}.jpg" : null; | |||
public static string GetGuildDiscoverySplashUrl(ulong guildId, string discoverySplashId, ushort size, ImageFormat format) | |||
{ | |||
if (discoverySplashId == null) | |||
return null; | |||
string extension = FormatToExtension(format, string.Empty); | |||
return $"{DiscordConfig.CDNUrl}discovery-splashes/{guildId}/{discoverySplashId}.{extension}?size={size}"; | |||
} | |||
/// <summary> | |||
/// Returns a channel icon URL. | |||
/// </summary> | |||
/// <param name="channelId">The channel snowflake identifier.</param> | |||
/// <param name="iconId">The icon identifier.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the channel's icon. | |||
/// </returns> | |||
public static string GetChannelIconUrl(ulong channelId, string iconId) | |||
=> iconId != null ? $"{DiscordConfig.CDNUrl}channel-icons/{channelId}/{iconId}.jpg" : null; | |||
public static string GetChannelIconUrl(ulong channelId, string iconId, ushort size, ImageFormat format) | |||
{ | |||
if (iconId == null) | |||
return null; | |||
string extension = FormatToExtension(format, iconId); | |||
return $"{DiscordConfig.CDNUrl}channel-icons/{channelId}/{iconId}.{extension}?size={size}"; | |||
} | |||
/// <summary> | |||
/// Returns a guild banner URL. | |||
/// </summary> | |||
/// <param name="guildId">The guild snowflake identifier.</param> | |||
/// <param name="bannerId">The banner image identifier.</param> | |||
/// <param name="size">The size of the image to return in horizontal pixels. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the guild's banner image. | |||
/// </returns> | |||
public static string GetGuildBannerUrl(ulong guildId, string bannerId, ushort? size = null) | |||
public static string GetGuildBannerUrl(ulong guildId, string bannerId, ushort? size = null, ImageFormat? format = null) | |||
{ | |||
if (!string.IsNullOrEmpty(bannerId)) | |||
return $"{DiscordConfig.CDNUrl}banners/{guildId}/{bannerId}.jpg" + (size.HasValue ? $"?size={size}" : string.Empty); | |||
return null; | |||
if (string.IsNullOrEmpty(bannerId)) | |||
return null; | |||
string extension = format.HasValue ? FormatToExtension(format.Value, string.Empty) : "png"; | |||
return $"{DiscordConfig.CDNUrl}banners/{guildId}/{bannerId}.{extension}" + (size.HasValue ? $"?size={size}" : string.Empty); | |||
} | |||
/// <summary> | |||
/// Returns an emoji URL. | |||
/// </summary> | |||
/// <param name="emojiId">The emoji snowflake identifier.</param> | |||
/// <param name="animated">Whether this emoji is animated.</param> | |||
/// <param name="size">The size of the image to return in horizontal pixels. This can be any power of two between 16 and 128.</param> | |||
/// <param name="format">The format to return.</param> | |||
/// <returns> | |||
/// A URL pointing to the custom emote. | |||
/// </returns> | |||
public static string GetEmojiUrl(ulong emojiId, bool animated) | |||
=> $"{DiscordConfig.CDNUrl}emojis/{emojiId}.{(animated ? "gif" : "png")}"; | |||
public static string GetEmojiUrl(ulong emojiId, bool animated, ushort size, ImageFormat format) | |||
{ | |||
string extension = format == ImageFormat.Auto && animated ? "gif" : FormatToExtension(format, string.Empty); | |||
return $"{DiscordConfig.CDNUrl}emojis/{emojiId}.{extension}?size={size}"; | |||
} | |||
/// <summary> | |||
/// Returns a Rich Presence asset URL. | |||
@@ -136,7 +182,7 @@ namespace Discord | |||
/// </returns> | |||
public static string GetRichAssetUrl(ulong appId, string assetId, ushort size, ImageFormat format) | |||
{ | |||
string extension = FormatToExtension(format, ""); | |||
string extension = FormatToExtension(format, string.Empty); | |||
return $"{DiscordConfig.CDNUrl}app-assets/{appId}/{assetId}.{extension}?size={size}"; | |||
} | |||
@@ -173,6 +219,8 @@ namespace Discord | |||
return "png"; | |||
case ImageFormat.WebP: | |||
return "webp"; | |||
case ImageFormat.Lottie: | |||
return "json"; | |||
default: | |||
throw new ArgumentException(nameof(format)); | |||
} | |||
@@ -29,7 +29,8 @@ namespace Discord | |||
/// <returns> | |||
/// A string that points to the URL of this emote. | |||
/// </returns> | |||
public string Url => CDN.GetEmojiUrl(Id, Animated); | |||
[Obsolete("This property is obsolete. Call GetUrl instead.")] | |||
public string Url => CDN.GetEmojiUrl(Id, Animated, 128, ImageFormat.Auto); | |||
internal Emote(ulong id, string name, bool animated) | |||
{ | |||
@@ -38,6 +39,15 @@ namespace Discord | |||
Animated = animated; | |||
} | |||
/// <summary> | |||
/// Get the URL for this Emote. | |||
/// </summary> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 128 inclusive.</param> | |||
/// <returns>A URL pointing to the custom emote.</returns> | |||
public string GetUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetEmojiUrl(Id, Animated, size, format); | |||
/// <summary> | |||
/// Determines whether the specified emote is equal to the current emote. | |||
/// </summary> | |||
@@ -324,6 +324,54 @@ namespace Discord | |||
/// </returns> | |||
CultureInfo PreferredCulture { get; } | |||
/// <summary> | |||
/// Get the icon URL for this Guild. | |||
/// </summary> | |||
/// <remarks> | |||
/// This property retrieves a URL for this Guild's icon. In event that the guild does not have a valid icon | |||
/// (i.e. their icon identifier is not set), this property will return <c>null</c>. | |||
/// </remarks> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <returns>A string representing the guild's icon URL; <c>null</c> if the guild does not have an icon in place.</returns> | |||
string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
/// <summary> | |||
/// Get the splash URL for this Guild. | |||
/// </summary> | |||
/// <remarks> | |||
/// This property retrieves a URL for this Guild's splash. In event that the guild does not have a valid splash | |||
/// (i.e. their splash identifier is not set), this property will return <c>null</c>. | |||
/// </remarks> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <returns>A string representing the guild's splash URL; <c>null</c> if the guild does not have an splash in place.</returns> | |||
string GetSplashUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
/// <summary> | |||
/// Get the discovery splash URL for this Guild. | |||
/// </summary> | |||
/// <remarks> | |||
/// This property retrieves a URL for this Guild's discovery splash. In event that the guild does not have a valid discovery splash | |||
/// (i.e. their discovery splash identifier is not set), this property will return <c>null</c>. | |||
/// </remarks> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <returns>A string representing the guild's discovery splash URL; <c>null</c> if the guild does not have a discovery splash in place.</returns> | |||
string GetDiscoverySplashUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
/// <summary> | |||
/// Get the banner URL for this Guild. | |||
/// </summary> | |||
/// <remarks> | |||
/// This property retrieves a URL for this Guild's banner. In event that the guild does not have a valid banner | |||
/// (i.e. their banner identifier is not set), this property will return <c>null</c>. | |||
/// </remarks> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <returns>A string representing the guild's banner URL; <c>null</c> if the guild does not have a banner in place.</returns> | |||
string GetBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
/// <summary> | |||
/// Modifies this guild. | |||
/// </summary> | |||
@@ -18,5 +18,17 @@ namespace Discord | |||
/// Returns the current user's permissions for this guild. | |||
/// </summary> | |||
GuildPermissions Permissions { get; } | |||
/// <summary> | |||
/// Get the icon URL for this UserGuild. | |||
/// </summary> | |||
/// <remarks> | |||
/// This property retrieves a URL for this UserGuild's icon. In event that the user guild does not have a valid icon | |||
/// (i.e. their icon identifier is not set), this property will return <c>null</c>. | |||
/// </remarks> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <returns>A string representing the user guild's icon URL; <c>null</c> if the user guild does not have an icon in place.</returns> | |||
string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
} | |||
} |
@@ -21,7 +21,7 @@ namespace Discord | |||
/// <summary> | |||
/// Gets the icon URL of the application. | |||
/// </summary> | |||
string IconUrl { get; } | |||
string IconUrl { get; } | |||
/// <summary> | |||
/// Gets if the bot is public. | |||
/// </summary> | |||
@@ -39,5 +39,17 @@ namespace Discord | |||
/// Gets the partial user object containing info on the owner of the application. | |||
/// </summary> | |||
IUser Owner { get; } | |||
/// <summary> | |||
/// Get the icon URL for this Application. | |||
/// </summary> | |||
/// <remarks> | |||
/// This property retrieves a URL for this Application's icon. In event that the application does not have a valid icon | |||
/// (i.e. their icon identifier is not set), this property will return <c>null</c>. | |||
/// </remarks> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <returns>A string representing the application's icon URL; <c>null</c> if the application does not have an icon in place.</returns> | |||
string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
} | |||
} |
@@ -25,5 +25,9 @@ namespace Discord | |||
/// Use GIF. | |||
/// </summary> | |||
Gif, | |||
/// <summary> | |||
/// Use Lottie. | |||
/// </summary> | |||
Lottie, | |||
} | |||
} |
@@ -27,5 +27,16 @@ namespace Discord | |||
/// Gets the user identifier that owns this team. | |||
/// </summary> | |||
ulong OwnerUserId { get; } | |||
/// <summary> | |||
/// Get the icon URL for this Team. | |||
/// </summary> | |||
/// <remarks> | |||
/// This property retrieves a URL for this Team's icon. In event that the team does not have a valid icon | |||
/// (i.e. their icon identifier is not set), this property will return <c>null</c>. | |||
/// </remarks> | |||
/// <param name="format">The format to return.</param> | |||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048 inclusive.</param> | |||
/// <returns>A string representing the team's icon URL; <c>null</c> if the team does not have an icon in place.</returns> | |||
string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
} | |||
} |
@@ -91,13 +91,17 @@ namespace Discord.Rest | |||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | |||
/// <inheritdoc /> | |||
public string IconUrl => CDN.GetGuildIconUrl(Id, IconId); | |||
[Obsolete("This property is obsolete. Call GetIconUrl instead.")] | |||
public string IconUrl => CDN.GetGuildIconUrl(Id, IconId, 128, ImageFormat.Jpeg); | |||
/// <inheritdoc /> | |||
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId); | |||
[Obsolete("This property is obsolete. Call GetSplashUrl instead.")] | |||
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId, 128, ImageFormat.Jpeg); | |||
/// <inheritdoc /> | |||
public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); | |||
[Obsolete("This property is obsolete. Call GetDiscoverySplashUrl instead.")] | |||
public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId, 128, ImageFormat.Jpeg); | |||
/// <inheritdoc /> | |||
public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId); | |||
[Obsolete("This property is obsolete. Call GetBannerUrl instead.")] | |||
public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId, 128, ImageFormat.Jpeg); | |||
/// <summary> | |||
/// Gets the built-in role containing all users in this guild. | |||
@@ -196,6 +200,19 @@ namespace Discord.Rest | |||
} | |||
//General | |||
/// <inheritdoc /> | |||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildIconUrl(Id, IconId, size, format); | |||
/// <inheritdoc /> | |||
public string GetSplashUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildSplashUrl(Id, SplashId, size, format); | |||
/// <inheritdoc /> | |||
public string GetDiscoverySplashUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId, size, format); | |||
/// <inheritdoc /> | |||
public string GetBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildBannerUrl(Id, BannerId, size, format); | |||
/// <inheritdoc /> | |||
public async Task UpdateAsync(RequestOptions options = null) | |||
=> Update(await Discord.ApiClient.GetGuildAsync(Id, false, options).ConfigureAwait(false)); | |||
@@ -20,7 +20,8 @@ namespace Discord.Rest | |||
/// <inheritdoc /> | |||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | |||
/// <inheritdoc /> | |||
public string IconUrl => CDN.GetGuildIconUrl(Id, _iconId); | |||
[Obsolete("This property is obsolete. Call GetIconUrl instead.")] | |||
public string IconUrl => CDN.GetGuildIconUrl(Id, _iconId, 128, ImageFormat.Jpeg); | |||
internal RestUserGuild(BaseDiscordClient discord, ulong id) | |||
: base(discord, id) | |||
@@ -40,7 +41,11 @@ namespace Discord.Rest | |||
Name = model.Name; | |||
Permissions = new GuildPermissions(model.Permissions); | |||
} | |||
/// <inheritdoc /> | |||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetApplicationIconUrl(Id, _iconId, size, format); | |||
public async Task LeaveAsync(RequestOptions options = null) | |||
{ | |||
await Discord.ApiClient.LeaveGuildAsync(Id, options).ConfigureAwait(false); | |||
@@ -34,7 +34,8 @@ namespace Discord.Rest | |||
/// <inheritdoc /> | |||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | |||
/// <inheritdoc /> | |||
public string IconUrl => CDN.GetApplicationIconUrl(Id, _iconId); | |||
[Obsolete("This property is obsolete. Call GetIconUrl instead.")] | |||
public string IconUrl => CDN.GetApplicationIconUrl(Id, _iconId, 128, ImageFormat.Jpeg); | |||
internal RestApplication(BaseDiscordClient discord, ulong id) | |||
: base(discord, id) | |||
@@ -47,7 +48,7 @@ namespace Discord.Rest | |||
return entity; | |||
} | |||
internal void Update(Model model) | |||
{ | |||
{ | |||
Description = model.Description; | |||
RPCOrigins = model.RPCOrigins; | |||
Name = model.Name; | |||
@@ -72,6 +73,10 @@ namespace Discord.Rest | |||
Update(response); | |||
} | |||
/// <inheritdoc /> | |||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetApplicationIconUrl(Id, _iconId, size, format); | |||
/// <summary> | |||
/// Gets the name of the application. | |||
/// </summary> | |||
@@ -1,6 +1,7 @@ | |||
using System.Collections.Generic; | |||
using System.Collections.Immutable; | |||
using System.Linq; | |||
using System; | |||
using Model = Discord.API.Team; | |||
namespace Discord.Rest | |||
@@ -8,7 +9,8 @@ namespace Discord.Rest | |||
public class RestTeam : RestEntity<ulong>, ITeam | |||
{ | |||
/// <inheritdoc /> | |||
public string IconUrl => _iconId != null ? CDN.GetTeamIconUrl(Id, _iconId) : null; | |||
[Obsolete("This property is obsolete. Call GetIconUrl instead.")] | |||
public string IconUrl => _iconId != null ? CDN.GetTeamIconUrl(Id, _iconId, 128, ImageFormat.Jpeg) : null; | |||
/// <inheritdoc /> | |||
public IReadOnlyList<ITeamMember> TeamMembers { get; private set; } | |||
/// <inheritdoc /> | |||
@@ -36,5 +38,9 @@ namespace Discord.Rest | |||
OwnerUserId = model.OwnerUserId; | |||
TeamMembers = model.TeamMembers.Select(x => new RestTeamMember(Discord, x)).ToImmutableArray(); | |||
} | |||
/// <inheritdoc /> | |||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetTeamIconUrl(Id, _iconId, size, format); | |||
} | |||
} |
@@ -125,13 +125,17 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | |||
/// <inheritdoc /> | |||
public string IconUrl => CDN.GetGuildIconUrl(Id, IconId); | |||
[Obsolete("This property is obsolete. Call GetIconUrl instead.")] | |||
public string IconUrl => CDN.GetGuildIconUrl(Id, IconId, 128, ImageFormat.Jpeg); | |||
/// <inheritdoc /> | |||
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId); | |||
[Obsolete("This property is obsolete. Call GetSplashUrl instead.")] | |||
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId, 128, ImageFormat.Jpeg); | |||
/// <inheritdoc /> | |||
public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); | |||
[Obsolete("This property is obsolete. Call GetDiscoverySplashUrl instead.")] | |||
public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId, 128, ImageFormat.Jpeg); | |||
/// <inheritdoc /> | |||
public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId); | |||
[Obsolete("This property is obsolete. Call GetBannerUrl instead.")] | |||
public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId, 128, ImageFormat.Jpeg); | |||
/// <summary> Indicates whether the client has all the members downloaded to the local guild cache. </summary> | |||
public bool HasAllMembers => MemberCount <= DownloadedMemberCount;// _downloaderPromise.Task.IsCompleted; | |||
/// <summary> Indicates whether the guild cache is synced to this guild. </summary> | |||
@@ -516,6 +520,19 @@ namespace Discord.WebSocket | |||
} | |||
//General | |||
/// <inheritdoc /> | |||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildIconUrl(Id, IconId, size, format); | |||
/// <inheritdoc /> | |||
public string GetSplashUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildSplashUrl(Id, SplashId, size, format); | |||
/// <inheritdoc /> | |||
public string GetDiscoverySplashUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId, size, format); | |||
/// <inheritdoc /> | |||
public string GetBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | |||
=> CDN.GetGuildBannerUrl(Id, BannerId, size, format); | |||
/// <inheritdoc /> | |||
public Task DeleteAsync(RequestOptions options = null) | |||
=> GuildHelper.DeleteAsync(this, Discord, options); | |||
@@ -1243,7 +1260,7 @@ namespace Discord.WebSocket | |||
Task<IReadOnlyCollection<IVoiceChannel>> IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options) | |||
=> Task.FromResult<IReadOnlyCollection<IVoiceChannel>>(VoiceChannels); | |||
/// <inheritdoc /> | |||
Task<IReadOnlyCollection<ICategoryChannel>> IGuild.GetCategoriesAsync(CacheMode mode , RequestOptions options) | |||
Task<IReadOnlyCollection<ICategoryChannel>> IGuild.GetCategoriesAsync(CacheMode mode, RequestOptions options) | |||
=> Task.FromResult<IReadOnlyCollection<ICategoryChannel>>(CategoryChannels); | |||
/// <inheritdoc /> | |||
Task<IVoiceChannel> IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options) | |||