Table of Contents

Class SocketGuildEvent

Namespace
Discord.WebSocket
Assembly
Discord.Net.WebSocket.dll

Represents a WebSocket-based guild event.

public class SocketGuildEvent : SocketEntity<ulong>, IGuildScheduledEvent, IEntity<ulong>
Inheritance
SocketGuildEvent
Implements
Inherited Members

Properties

Channel

Gets the channel of the event.

public SocketGuildChannel Channel { get; }

Property Value

SocketGuildChannel

CoverImageId

Gets the banner asset id of the event.

public string CoverImageId { get; }

Property Value

string

Creator

Gets the user who created the event.

public SocketGuildUser Creator { get; }

Property Value

SocketGuildUser

Description

Gets the description of the event.

public string Description { get; }

Property Value

string

Remarks

This field is null when the event doesn't have a description.

EndTime

Gets the optional end time of the event.

public DateTimeOffset? EndTime { get; }

Property Value

DateTimeOffset?

EntityId

Gets the optional entity id of the event. The "entity" of the event can be a stage instance event as is separate from ChannelId.

public ulong? EntityId { get; }

Property Value

ulong?

Guild

Gets the guild of the event.

public SocketGuild Guild { get; }

Property Value

SocketGuild

GuildId

Gets the id of the guild this event is scheduled in.

public ulong GuildId { get; }

Property Value

ulong

Location

Gets the location of the event if the Type is external.

public string Location { get; }

Property Value

string

Name

Gets the name of the event.

public string Name { get; }

Property Value

string

PrivacyLevel

Gets the privacy level of the event.

public GuildScheduledEventPrivacyLevel PrivacyLevel { get; }

Property Value

GuildScheduledEventPrivacyLevel

RecurrenceRule

Gets the definition for how often this event should recur. if not set.

public GuildScheduledEventRecurrenceRule? RecurrenceRule { get; }

Property Value

GuildScheduledEventRecurrenceRule?

StartTime

Gets the start time of the event.

public DateTimeOffset StartTime { get; }

Property Value

DateTimeOffset

Status

Gets the status of the event.

public GuildScheduledEventStatus Status { get; }

Property Value

GuildScheduledEventStatus

Type

Gets the type of the event.

public GuildScheduledEventType Type { get; }

Property Value

GuildScheduledEventType

UserCount

Gets the user count of the event.

public int? UserCount { get; }

Property Value

int?

Methods

DeleteAsync(RequestOptions)

Deletes the current event.

public Task DeleteAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous delete operation.

EndAsync(RequestOptions)

Ends or cancels the event.

public Task EndAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous end operation.

GetCoverImageUrl(ImageFormat, ushort)

Gets this events banner image url.

public string GetCoverImageUrl(ImageFormat format = ImageFormat.Auto, ushort size = 1024)

Parameters

format ImageFormat

The format to return.

size ushort

The size of the image to return in. This can be any power of two between 16 and 2048.

Returns

string

The cover images url.

GetUsersAsync(RequestOptions)

Gets a collection of N users interested in the event.

public IAsyncEnumerable<IReadOnlyCollection<RestUser>> GetUsersAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

IAsyncEnumerable<IReadOnlyCollection<RestUser>>

Paged collection of users.

Remarks

important

The returned collection is an asynchronous enumerable object; one must call FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) to access the individual messages as a collection.

This method will attempt to fetch all users that are interested in the event. The library will attempt to split up the requests according to and MaxGuildEventUsersPerBatch. In other words, if there are 300 users, and the MaxGuildEventUsersPerBatch constant is 100, the request will be split into 3 individual requests; thus returning 3 individual asynchronous responses, hence the need of flattening.

GetUsersAsync(int, RequestOptions)

Gets a collection of users that are interested in this event.

public Task<IReadOnlyCollection<RestUser>> GetUsersAsync(int limit = 100, RequestOptions options = null)

Parameters

limit int

The amount of users to fetch.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestUser>>

A read-only collection of users.

GetUsersAsync(ulong, Direction, int, RequestOptions)

Gets a collection of N users interested in the event.

public IAsyncEnumerable<IReadOnlyCollection<RestUser>> GetUsersAsync(ulong fromUserId, Direction dir, int limit = 100, RequestOptions options = null)

Parameters

fromUserId ulong

The ID of the starting user to get the users from.

dir Direction

The direction of the users to be gotten from.

limit int

The numbers of users to be gotten from.

options RequestOptions

The options to be used when sending the request.

Returns

IAsyncEnumerable<IReadOnlyCollection<RestUser>>

Paged collection of users.

Remarks

important

The returned collection is an asynchronous enumerable object; one must call FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) to access the individual users as a collection.

warning

Do not fetch too many users at once! This may cause unwanted preemptive rate limit or even actual rate limit, causing your bot to freeze!

This method will attempt to fetch the number of users specified under limit around the user fromUserId depending on the dir. The library will attempt to split up the requests according to your limit and MaxGuildEventUsersPerBatch. In other words, should the user request 500 users, and the MaxGuildEventUsersPerBatch constant is 100, the request will be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need of flattening.

ModifyAsync(Action<GuildScheduledEventsProperties>, RequestOptions)

Modifies the guild event.

public Task ModifyAsync(Action<GuildScheduledEventsProperties> func, RequestOptions options = null)

Parameters

func Action<GuildScheduledEventsProperties>

The delegate containing the properties to modify the event with.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous modification operation.

StartAsync(RequestOptions)

Starts the event.

public Task StartAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous start operation.