[Feature] Scheduled event recurrence rule (#3023)

* api modelsssssssss

* recurrence rulesssss
This commit is contained in:
Mihail Gribkov
2024-12-21 04:16:11 +08:00
committed by GitHub
parent 438e31edd1
commit b7208d4d99
24 changed files with 585 additions and 131 deletions

View File

@@ -1417,6 +1417,7 @@ namespace Discord.WebSocket
/// <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>
/// <param name="recurrenceRule">The definition for how often this event should recur.</param>
/// <returns>
/// A task that represents the asynchronous create operation.
/// </returns>
@@ -1430,7 +1431,8 @@ namespace Discord.WebSocket
ulong? channelId = null,
string location = null,
Image? coverImage = null,
RequestOptions options = null)
RequestOptions options = null,
GuildScheduledEventRecurrenceRuleProperties recurrenceRule = null)
{
// requirements taken from https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-permissions-requirements
switch (type)
@@ -1446,7 +1448,7 @@ namespace Discord.WebSocket
break;
}
return GuildHelper.CreateGuildEventAsync(Discord, this, name, privacyLevel, startTime, type, description, endTime, channelId, location, coverImage, options);
return GuildHelper.CreateGuildEventAsync(Discord, this, name, privacyLevel, startTime, type, description, endTime, channelId, location, coverImage, options, recurrenceRule);
}

View File

@@ -65,6 +65,9 @@ namespace Discord.WebSocket
/// <inheritdoc/>
public int? UserCount { get; private set; }
/// <inheritdoc/>
public GuildScheduledEventRecurrenceRule? RecurrenceRule { get; private set; }
internal SocketGuildEvent(DiscordSocketClient client, SocketGuild guild, ulong id)
: base(client, id)
{
@@ -117,6 +120,8 @@ namespace Discord.WebSocket
UserCount = model.UserCount.ToNullable();
CoverImageId = model.Image;
GuildId = model.GuildId;
RecurrenceRule = model.RecurrenceRule?.ToEntity();
}
/// <inheritdoc/>