Skip to main content

Class SocketVoiceChannel

Represents a WebSocket-based voice channel in a guild.

Assembly: Discord.Net.WebSocket.dll​
View Source​
Declaration
public class SocketVoiceChannel : SocketGuildChannel, IVoiceChannel, INestedChannel, IGuildChannel, IDeletable, IMentionable, ISocketAudioChannel, IAudioChannel, IChannel, ISnowflakeEntity, IEntity<ulong>

Properties​

Bitrate​

Gets the bit-rate that the clients in this voice channel are requested to use.

View Source​
Declaration
public int Bitrate { get; }

UserLimit​

Gets the max number of users allowed to be connected to this channel at once.

View Source​
Declaration
public int? UserLimit { get; }

CategoryId​

Gets the parent (category) ID of this channel in the guild's channel list.

View Source​
Declaration
public ulong? CategoryId { get; }

Category​

Gets the parent (category) channel of this channel.

View Source​
Declaration
public ICategoryChannel Category { get; }

Mention​

Returns a special string used to mention this object.

View Source​
Declaration
public string Mention { get; }

Users​

Gets a collection of users that are currently connected to this voice channel.

View Source​
Declaration
public override IReadOnlyCollection<SocketGuildUser> Users { get; }

Methods​

SyncPermissionsAsync(RequestOptions)​

Syncs the permissions of this nested channel with its parent's.

View Source​
Declaration
public Task SyncPermissionsAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for syncing channel permissions with its parent's.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

ModifyAsync(Action<VoiceChannelProperties>, RequestOptions)​

Modifies this voice channel.

View Source​
Declaration
public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous modification operation.

Parameters​
TypeNameDescription
System.Action<Discord.VoiceChannelProperties>funcThe properties to modify the channel with.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

ConnectAsync(Boolean, Boolean, Boolean)​

Connects to this audio channel.

View Source​
Declaration
public async Task<IAudioClient> ConnectAsync(bool selfDeaf = false, bool selfMute = false, bool external = false)
Returns​

System.Threading.Tasks.Task<Discord.Audio.IAudioClient>: A task representing the asynchronous connection operation. The task result contains the Discord.Audio.IAudioClient responsible for the connection.

Parameters​
TypeNameDescription
System.BooleanselfDeafDetermines whether the client should deaf itself upon connection.
System.BooleanselfMuteDetermines whether the client should mute itself upon connection.
System.BooleanexternalDetermines whether the audio client is an external one or not.

DisconnectAsync()​

Disconnects from this audio channel.

View Source​
Declaration
public async Task DisconnectAsync()
Returns​

System.Threading.Tasks.Task: A task representing the asynchronous operation for disconnecting from the audio channel.

GetUser(UInt64)​

View Source​
Declaration
public override SocketGuildUser GetUser(ulong id)
Returns​

Discord.WebSocket.SocketGuildUser

Parameters​
TypeName
System.UInt64id

CreateInviteAsync(Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​

Creates a new invite to this channel.

View Source​
Declaration
public async Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IInviteMetadata>: A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

Parameters​
TypeNameDescription
System.Nullable<System.Int32>maxAgeThe time (in seconds) until the invite expires. Set to null to never expire.
System.Nullable<System.Int32>maxUsesThe max amount of times this invite may be used. Set to null to have unlimited uses.
System.BooleanisTemporaryIf true, the user accepting this invite will be kicked from the guild after closing their client.
System.BooleanisUniqueIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
Discord.RequestOptionsoptionsThe options to be used when sending the request.

CreateInviteToApplicationAsync(UInt64, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​

Creates a new invite to this channel.

View Source​
Declaration
public async Task<IInviteMetadata> CreateInviteToApplicationAsync(ulong applicationId, int? maxAge, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IInviteMetadata>: A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

Parameters​
TypeNameDescription
System.UInt64applicationIdThe id of the embedded application to open for this invite.
System.Nullable<System.Int32>maxAgeThe time (in seconds) until the invite expires. Set to null to never expire.
System.Nullable<System.Int32>maxUsesThe max amount of times this invite may be used. Set to null to have unlimited uses.
System.BooleanisTemporaryIf true, the user accepting this invite will be kicked from the guild after closing their client.
System.BooleanisUniqueIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
Discord.RequestOptionsoptionsThe options to be used when sending the request.

CreateInviteToApplicationAsync(DefaultApplications, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​

Creates a new invite to this channel.

View Source​
Declaration
public virtual async Task<IInviteMetadata> CreateInviteToApplicationAsync(DefaultApplications application, int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IInviteMetadata>: A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

Parameters​
TypeNameDescription
Discord.DefaultApplicationsapplicationThe application to open for this invite.
System.Nullable<System.Int32>maxAgeThe time (in seconds) until the invite expires. Set to null to never expire.
System.Nullable<System.Int32>maxUsesThe max amount of times this invite may be used. Set to null to have unlimited uses.
System.BooleanisTemporaryIf true, the user accepting this invite will be kicked from the guild after closing their client.
System.BooleanisUniqueIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
Discord.RequestOptionsoptionsThe options to be used when sending the request.

CreateInviteToStreamAsync(IUser, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​

Creates a new invite to this channel.

View Source​
Declaration
public async Task<IInviteMetadata> CreateInviteToStreamAsync(IUser user, int? maxAge, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IInviteMetadata>: A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

Parameters​
TypeNameDescription
Discord.IUseruserThe id of the user whose stream to display for this invite.
System.Nullable<System.Int32>maxAgeThe time (in seconds) until the invite expires. Set to null to never expire.
System.Nullable<System.Int32>maxUsesThe max amount of times this invite may be used. Set to null to have unlimited uses.
System.BooleanisTemporaryIf true, the user accepting this invite will be kicked from the guild after closing their client.
System.BooleanisUniqueIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetInvitesAsync(RequestOptions)​

Gets a collection of all invites to this channel.

View Source​
Declaration
public async Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IInviteMetadata>>: A task that represents the asynchronous get operation. The task result contains a read-only collection of invite metadata that are created for this channel.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

IGuildChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)​

Gets a user in this channel.

View Source​
Declaration
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Returns​

System.Threading.Tasks.Task<Discord.IGuildUser>: A task representing the asynchronous get operation. The task result contains a guild user object that represents the user; null if none is found.

Parameters​
TypeNameDescription
System.UInt64idThe snowflake identifier of the user.
Discord.CacheModemodeThe Discord.CacheMode that determines whether the object should be fetched from cache.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

IGuildChannel.GetUsersAsync(CacheMode, RequestOptions)​

Gets a collection of users that are able to view the channel or are currently in this channel.

View Source​
Declaration
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
Returns​

System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<Discord.IGuildUser>>: Paged collection of users.

Parameters​
TypeNameDescription
Discord.CacheModemodeThe Discord.CacheMode that determines whether the object should be fetched from cache.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

INestedChannel.GetCategoryAsync(CacheMode, RequestOptions)​

Gets the parent (category) channel of this channel.

View Source​
Declaration
Task<ICategoryChannel> INestedChannel.GetCategoryAsync(CacheMode mode, RequestOptions options)
Returns​

System.Threading.Tasks.Task<Discord.ICategoryChannel>: A task that represents the asynchronous get operation. The task result contains the category channel representing the parent of this channel; null if none is set.

Parameters​
TypeNameDescription
Discord.CacheModemodeThe Discord.CacheMode that determines whether the object should be fetched from cache.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

Implements​