Class SocketGuildEvent
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
CoverImageId
Gets the banner asset id of the event.
public string CoverImageId { get; }
Property Value
Creator
Gets the user who created the event.
public SocketGuildUser Creator { get; }
Property Value
Description
Gets the description of the event.
public string Description { get; }
Property Value
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
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
Guild
Gets the guild of the event.
public SocketGuild Guild { get; }
Property Value
GuildId
Gets the id of the guild this event is scheduled in.
public ulong GuildId { get; }
Property Value
Location
Gets the location of the event if the Type is external.
public string Location { get; }
Property Value
Name
Gets the name of the event.
public string Name { get; }
Property Value
PrivacyLevel
Gets the privacy level of the event.
public GuildScheduledEventPrivacyLevel PrivacyLevel { get; }
Property Value
StartTime
Gets the start time of the event.
public DateTimeOffset StartTime { get; }
Property Value
Status
Gets the status of the event.
public GuildScheduledEventStatus Status { get; }
Property Value
Type
Gets the type of the event.
public GuildScheduledEventType Type { get; }
Property Value
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
RequestOptionsThe 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
RequestOptionsThe 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
ImageFormatThe format to return.
size
ushortThe 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
RequestOptionsThe 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.
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
intThe amount of users to fetch.
options
RequestOptionsThe 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
ulongThe ID of the starting user to get the users from.
dir
DirectionThe direction of the users to be gotten from.
limit
intThe numbers of users to be gotten from.
options
RequestOptionsThe 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!
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
RequestOptionsThe 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
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous start operation.