Table of Contents

Class SocketGuildChannel

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

Represents a WebSocket-based guild channel.

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

Properties

Flags

Gets the flags related to this channel.

public ChannelFlags Flags { get; }

Property Value

ChannelFlags

A channel's flags, if any is associated.

Remarks

This value is determined by bitwise OR-ing ChannelFlags values together.

Guild

Gets the guild associated with this channel.

public SocketGuild Guild { get; }

Property Value

SocketGuild

A guild object that this channel belongs to.

Name

public string Name { get; }

Property Value

string

PermissionOverwrites

Gets a collection of permission overwrites for this channel.

public virtual IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }

Property Value

IReadOnlyCollection<Overwrite>

A collection of overwrites associated with 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.

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).

Remarks

If this channel is a voice channel, use ConnectedUsers to retrieve a collection of users who are currently connected to this channel.

Methods

AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)

Adds or updates the permission overwrite for the given role.

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

Parameters

role IRole

The role to add the overwrite to.

permissions OverwritePermissions

The overwrite to add to the role.

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(IUser, OverwritePermissions, RequestOptions)

Adds or updates the permission overwrite for the given user.

public virtual Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)

Parameters

user IUser

The user to add the overwrite to.

permissions OverwritePermissions

The overwrite to add to the user.

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)

public virtual SocketGuildUser GetUser(ulong id)

Parameters

id ulong

Returns

SocketGuildUser

ModifyAsync(Action<GuildChannelProperties>, RequestOptions)

Modifies this guild channel.

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

Parameters

func Action<GuildChannelProperties>

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 GuildChannelProperties.

RemovePermissionOverwriteAsync(IRole, RequestOptions)

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

public virtual 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.

RemovePermissionOverwriteAsync(IUser, RequestOptions)

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

public virtual Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)

Parameters

user IUser

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.

ToString()

Gets the name of the channel.

public override string ToString()

Returns

string

A string that resolves to Name.