@@ -56,10 +56,13 @@ namespace Discord | |||||
/// <returns> | /// <returns> | ||||
/// A URL pointing to the guild's icon in the specified size. | /// A URL pointing to the guild's icon in the specified size. | ||||
/// </returns> | /// </returns> | ||||
public static string GetGuildIconUrl(ulong guildId, string iconId, ushort size, ImageFormat format) | |||||
public static string GetGuildIconUrl(ulong guildId, string iconId, ImageFormat format, ushort size) | |||||
{ | { | ||||
if (string.IsNullOrWhiteSpace(iconId)) | if (string.IsNullOrWhiteSpace(iconId)) | ||||
return null; | return null; | ||||
if (format == ImageFormat.Gif) | |||||
throw new ArgumentException("Requested image format mustn't be a gif."); | |||||
string extension = FormatToExtension(format, iconId); | string extension = FormatToExtension(format, iconId); | ||||
return $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.{extension}?size={size}"; | return $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.{extension}?size={size}"; | ||||
} | } | ||||
@@ -60,7 +60,7 @@ namespace Discord.Rest | |||||
public ulong DefaultChannelId => Id; | public ulong DefaultChannelId => Id; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
=> CDN.GetGuildIconUrl(Id, IconId, size, format); | |||||
=> CDN.GetGuildIconUrl(Id, IconId, format, size); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId); | public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId); | ||||
@@ -21,7 +21,7 @@ namespace Discord.Rest | |||||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
=> CDN.GetGuildIconUrl(Id, _iconId, size, format); | |||||
=> CDN.GetGuildIconUrl(Id, _iconId, format, size); | |||||
internal RestUserGuild(BaseDiscordClient discord, ulong id) | internal RestUserGuild(BaseDiscordClient discord, ulong id) | ||||
: base(discord, id) | : base(discord, id) | ||||
@@ -98,7 +98,7 @@ namespace Discord.WebSocket | |||||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | public string GetIconUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
=> CDN.GetGuildIconUrl(Id, IconId, size, format); | |||||
=> CDN.GetGuildIconUrl(Id, IconId, format, size); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId); | public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId); | ||||
/// <summary> Indicates whether the client has all the members downloaded to the local guild cache. </summary> | /// <summary> Indicates whether the client has all the members downloaded to the local guild cache. </summary> | ||||