diff --git a/src/Discord.Net.Core/CDN.cs b/src/Discord.Net.Core/CDN.cs index ecce668f..a41eda35 100644 --- a/src/Discord.Net.Core/CDN.cs +++ b/src/Discord.Net.Core/CDN.cs @@ -223,7 +223,7 @@ namespace Discord => $"{DiscordConfig.CDNUrl}stickers/{stickerId}.{FormatToExtension(format)}"; /// - /// Returns an events cover image url. + /// Returns an events cover image url. if the assetId . /// /// The guild id that the event is in. /// The id of the event. @@ -232,7 +232,9 @@ namespace Discord /// The size of the image. /// public static string GetEventCoverImageUrl(ulong guildId, ulong eventId, string assetId, ImageFormat format = ImageFormat.Auto, ushort size = 1024) - => $"{DiscordConfig.CDNUrl}guild-events/{eventId}/{assetId}.{FormatToExtension(format, assetId)}?size={size}"; + => string.IsNullOrEmpty(assetId) + ? null + : $"{DiscordConfig.CDNUrl}guild-events/{eventId}/{assetId}.{FormatToExtension(format, assetId)}?size={size}"; private static string FormatToExtension(StickerFormatType format) { diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuildEvent.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuildEvent.cs index ee1b14d7..59791984 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuildEvent.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuildEvent.cs @@ -110,7 +110,7 @@ namespace Discord.Rest /// public string GetCoverImageUrl(ImageFormat format = ImageFormat.Auto, ushort size = 1024) - => CDN.GetEventCoverImageUrl(Guild.Id, Id, CoverImageId, format, size); + => CDN.GetEventCoverImageUrl(GuildId, Id, CoverImageId, format, size); /// public Task StartAsync(RequestOptions options = null) diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs index cb0ef05d..07ec839c 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs @@ -121,7 +121,7 @@ namespace Discord.WebSocket /// public string GetCoverImageUrl(ImageFormat format = ImageFormat.Auto, ushort size = 1024) - => CDN.GetEventCoverImageUrl(Guild.Id, Id, CoverImageId, format, size); + => CDN.GetEventCoverImageUrl(GuildId, Id, CoverImageId, format, size); /// public Task DeleteAsync(RequestOptions options = null)