Table of Contents

Class SocketGuildChannel

Namespace
Kook.WebSocket
Assembly
Kook.Net.WebSocket.dll

Represent a WebSocket-based guild channel.

public class SocketGuildChannel : SocketChannel, IUpdateable, IGuildChannel, IChannel, IEntity<ulong>, IDeletable
Inheritance
SocketGuildChannel
Implements
Derived
Inherited Members
Extension Methods

Properties

Creator

Gets the creator of this channel.

public SocketGuildUser Creator { get; }

Property Value

SocketGuildUser

A task that represents the asynchronous get operation. The task result contains the creator of this channel.

Remarks

This method will try to get the user as a member of this channel. If the user is not a member of this guild, this method will return null. To get the creator under this circumstance, use GetUserAsync(ulong, RequestOptions).

CreatorId

Gets the identifier of the user who created this channel.

public ulong CreatorId { get; }

Property Value

ulong

A ulong representing the identifier of the user who created this channel.

Guild

Gets the guild associated with this channel.

public SocketGuild Guild { get; }

Property Value

SocketGuild

A guild object that this channel belongs to.

Name

Gets the name of this channel.

public string Name { get; }

Property Value

string

A string containing the name of this channel.

Position

Gets the position of this channel.

public int? Position { get; }

Property Value

int?

An int representing the position of this channel in the guild's channel list relative to others of the same type.

RolePermissionOverwrites

Gets a collection of permission overwrites for roles for this channel.

public IReadOnlyCollection<RolePermissionOverwrite> RolePermissionOverwrites { get; }

Property Value

IReadOnlyCollection<RolePermissionOverwrite>

A collection of overwrites for roles associated with this channel.

Type

Gets the type of this channel.

public ChannelType Type { get; }

Property Value

ChannelType

A ChannelType representing the type of this channel.

UserPermissionOverwrites

Gets a collection of permission overwrites for users for this channel.

public IReadOnlyCollection<UserPermissionOverwrite> UserPermissionOverwrites { get; }

Property Value

IReadOnlyCollection<UserPermissionOverwrite>

A collection of overwrites for users associated with this channel.

Users

Gets a collection of users that are able to view the channel.

public virtual IReadOnlyCollection<SocketGuildUser> Users { get; }

Property Value

IReadOnlyCollection<SocketGuildUser>

A read-only collection of users that can access the channel (i.e. the users seen in the user list).

Methods

AddPermissionOverwriteAsync(IGuildUser, RequestOptions)

Adds or updates the permission overwrite for the given user.

public Task AddPermissionOverwriteAsync(IGuildUser user, RequestOptions options = null)

Parameters

user IGuildUser

The user to add the overwrite to.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task representing the asynchronous permission operation for adding the specified permissions to the channel.

AddPermissionOverwriteAsync(IRole, RequestOptions)

Adds or updates the permission overwrite for the given role.

public Task AddPermissionOverwriteAsync(IRole role, RequestOptions options = null)

Parameters

role IRole

The role to add the overwrite to.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task representing the asynchronous permission operation for adding the specified permissions to the channel.

DeleteAsync(RequestOptions)

Deletes this object and all its children.

public Task DeleteAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

GetPermissionOverwrite(IRole)

Gets the permission overwrite for a specific role.

public virtual OverwritePermissions? GetPermissionOverwrite(IRole role)

Parameters

role IRole

The role to get the overwrite from.

Returns

OverwritePermissions?

An overwrite object for the targeted role; null if none is set.

GetPermissionOverwrite(IUser)

Gets the permission overwrite for a specific user.

public virtual OverwritePermissions? GetPermissionOverwrite(IUser user)

Parameters

user IUser

The user to get the overwrite from.

Returns

OverwritePermissions?

An overwrite object for the targeted user; null if none is set.

GetUser(ulong)

Gets a SocketGuildUser from this channel.

public virtual SocketGuildUser GetUser(ulong id)

Parameters

id ulong

The user's identifier.

Returns

SocketGuildUser

A SocketGuildUser with the provided identifier; null if none is found.

ModifyAsync(Action<ModifyGuildChannelProperties>, RequestOptions)

Modifies this guild channel.

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

Parameters

func Action<ModifyGuildChannelProperties>

The delegate containing the properties to modify the channel with.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous modification operation.

Remarks

This method modifies the current guild channel with the specified properties. To see an example of this method and what properties are available, please refer to ModifyGuildChannelProperties.

ModifyPermissionOverwriteAsync(IGuildUser, Func<OverwritePermissions, OverwritePermissions>, RequestOptions)

Updates the permission overwrite for the given user, if one exists.

public Task ModifyPermissionOverwriteAsync(IGuildUser user, Func<OverwritePermissions, OverwritePermissions> func, RequestOptions options = null)

Parameters

user IGuildUser

The user to modify the overwrite for.

func Func<OverwritePermissions, OverwritePermissions>

A delegate containing the values to modify the permission overwrite with.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task representing the asynchronous operation for removing the specified permissions from the channel.

ModifyPermissionOverwriteAsync(IRole, Func<OverwritePermissions, OverwritePermissions>, RequestOptions)

Updates the permission overwrite for the given role, if one exists.

public Task ModifyPermissionOverwriteAsync(IRole role, Func<OverwritePermissions, OverwritePermissions> func, RequestOptions options = null)

Parameters

role IRole

The role to remove the overwrite for.

func Func<OverwritePermissions, OverwritePermissions>

A delegate containing the values to modify the permission overwrite with.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task representing the asynchronous operation for removing the specified permissions from the channel.

RemovePermissionOverwriteAsync(IGuildUser, RequestOptions)

Removes the permission overwrite for the given user, if one exists.

public Task RemovePermissionOverwriteAsync(IGuildUser user, RequestOptions options = null)

Parameters

user IGuildUser

The user to remove the overwrite from.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task representing the asynchronous operation for removing the specified permissions from the channel.

RemovePermissionOverwriteAsync(IRole, RequestOptions)

Removes the permission overwrite for the given role, if one exists.

public Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)

Parameters

role IRole

The role to remove the overwrite from.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task representing the asynchronous operation for removing the specified permissions from the channel.

ToString()

Gets the name of the channel.

public override string ToString()

Returns

string

A string that resolves to Name.

UpdateAsync(RequestOptions)

Updates this object's properties with its current state.

public override Task UpdateAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents an asynchronous reloading operation.

Remarks

warning

This method will fetch the latest data from REST API, and replace the current object's properties with the new data.