Add Image property to Guild Scheduled Events (#2151)
* Add Image property to create and modify events * Add CDN routes to get cover image * Update banner names * Update CDN.cs * Update IGuildScheduledEvent.cs
This commit is contained in:
@@ -208,6 +208,18 @@ namespace Discord
|
||||
public static string GetStickerUrl(ulong stickerId, StickerFormatType format = StickerFormatType.Png)
|
||||
=> $"{DiscordConfig.CDNUrl}stickers/{stickerId}.{FormatToExtension(format)}";
|
||||
|
||||
/// <summary>
|
||||
/// Returns an events cover image url.
|
||||
/// </summary>
|
||||
/// <param name="guildId">The guild id that the event is in.</param>
|
||||
/// <param name="eventId">The id of the event.</param>
|
||||
/// <param name="assetId">The id of the cover image asset.</param>
|
||||
/// <param name="format">The format of the image.</param>
|
||||
/// <param name="size">The size of the image.</param>
|
||||
/// <returns></returns>
|
||||
public static string GetEventCoverImageUrl(ulong guildId, ulong eventId, string assetId, ImageFormat format = ImageFormat.Auto, ushort size = 1024)
|
||||
=> $"{DiscordConfig.CDNUrl}guild-events/{guildId}/{eventId}/{assetId}.{FormatToExtension(format, assetId)}?size={size}";
|
||||
|
||||
private static string FormatToExtension(StickerFormatType format)
|
||||
{
|
||||
return format switch
|
||||
|
||||
@@ -54,5 +54,10 @@ namespace Discord
|
||||
/// Gets or sets the status of the event.
|
||||
/// </summary>
|
||||
public Optional<GuildScheduledEventStatus> Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the banner image of the event.
|
||||
/// </summary>
|
||||
public Optional<Image?> CoverImage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,6 +1105,7 @@ namespace Discord
|
||||
/// </param>
|
||||
/// <param name="speakers">A collection of speakers for the event.</param>
|
||||
/// <param name="location">The location of the event; links are supported</param>
|
||||
/// <param name="coverImage">The optional banner image for the event.</param>
|
||||
/// <param name="options">The options to be used when sending the request.</param>
|
||||
/// <returns>
|
||||
/// A task that represents the asynchronous create operation.
|
||||
@@ -1118,6 +1119,7 @@ namespace Discord
|
||||
DateTimeOffset? endTime = null,
|
||||
ulong? channelId = null,
|
||||
string location = null,
|
||||
Image? coverImage = null,
|
||||
RequestOptions options = null);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -39,6 +39,11 @@ namespace Discord
|
||||
/// </remarks>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the banner asset id of the event.
|
||||
/// </summary>
|
||||
string CoverImageId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the start time of the event.
|
||||
/// </summary>
|
||||
@@ -80,6 +85,14 @@ namespace Discord
|
||||
/// </summary>
|
||||
int? UserCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets this events banner image url.
|
||||
/// </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 2048.
|
||||
/// <returns>The cover images url.</returns>
|
||||
string GetCoverImageUrl(ImageFormat format = ImageFormat.Auto, ushort size = 1024);
|
||||
|
||||
/// <summary>
|
||||
/// Starts the event.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user