Class SocketVoiceChannel
Represents a WebSocket-based voice channel in a guild.
Assembly: Discord.Net.WebSocket.dll​
View Source​
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​
public int Bitrate { get; }
UserLimit​
Gets the max number of users allowed to be connected to this channel at once.
View Source​
public int? UserLimit { get; }
CategoryId​
Gets the parent (category) ID of this channel in the guild's channel list.
View Source​
public ulong? CategoryId { get; }
Category​
Gets the parent (category) channel of this channel.
View Source​
public ICategoryChannel Category { get; }
Mention​
Returns a special string used to mention this object.
View Source​
public string Mention { get; }
Users​
Gets a collection of users that are currently connected to this voice channel.
View Source​
public override IReadOnlyCollection<SocketGuildUser> Users { get; }
Methods​
SyncPermissionsAsync(RequestOptions)​
Syncs the permissions of this nested channel with its parent's.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
ModifyAsync(Action<VoiceChannelProperties>, RequestOptions)​
Modifies this voice channel.
View Source​
public Task ModifyAsync(Action<VoiceChannelProperties> func, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous modification operation.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.VoiceChannelProperties> | func | The properties to modify the channel with. |
Discord.RequestOptions | options | The options to be used when sending the request. |
ConnectAsync(Boolean, Boolean, Boolean)​
Connects to this audio channel.
View Source​
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​
Type | Name | Description |
---|---|---|
System.Boolean | selfDeaf | Determines whether the client should deaf itself upon connection. |
System.Boolean | selfMute | Determines whether the client should mute itself upon connection. |
System.Boolean | external | Determines whether the audio client is an external one or not. |
DisconnectAsync()​
Disconnects from this audio channel.
View Source​
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​
public override SocketGuildUser GetUser(ulong id)
Returns​
Discord.WebSocket.SocketGuildUser
Parameters​
Type | Name |
---|---|
System.UInt64 | id |
CreateInviteAsync(Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​
Creates a new invite to this channel.
View Source​
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​
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | maxAge | The time (in seconds) until the invite expires. Set to null to never expire. |
System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to null to have unlimited uses. |
System.Boolean | isTemporary | If true , the user accepting this invite will be kicked from the guild after closing their client. |
System.Boolean | isUnique | If true , don't try to reuse a similar invite (useful for creating many unique one time use invites). |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
System.UInt64 | applicationId | The id of the embedded application to open for this invite. |
System.Nullable<System.Int32> | maxAge | The time (in seconds) until the invite expires. Set to null to never expire. |
System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to null to have unlimited uses. |
System.Boolean | isTemporary | If true , the user accepting this invite will be kicked from the guild after closing their client. |
System.Boolean | isUnique | If true , don't try to reuse a similar invite (useful for creating many unique one time use invites). |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
Discord.DefaultApplications | application | The application to open for this invite. |
System.Nullable<System.Int32> | maxAge | The time (in seconds) until the invite expires. Set to null to never expire. |
System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to null to have unlimited uses. |
System.Boolean | isTemporary | If true , the user accepting this invite will be kicked from the guild after closing their client. |
System.Boolean | isUnique | If true , don't try to reuse a similar invite (useful for creating many unique one time use invites). |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
Discord.IUser | user | The id of the user whose stream to display for this invite. |
System.Nullable<System.Int32> | maxAge | The time (in seconds) until the invite expires. Set to null to never expire. |
System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to null to have unlimited uses. |
System.Boolean | isTemporary | If true , the user accepting this invite will be kicked from the guild after closing their client. |
System.Boolean | isUnique | If true , don't try to reuse a similar invite (useful for creating many unique one time use invites). |
Discord.RequestOptions | options | The options to be used when sending the request. |
GetInvitesAsync(RequestOptions)​
Gets a collection of all invites to this channel.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
IGuildChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)​
Gets a user in this channel.
View Source​
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​
Type | Name | Description |
---|---|---|
System.UInt64 | id | The snowflake identifier of the user. |
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |
INestedChannel.GetCategoryAsync(CacheMode, RequestOptions)​
Gets the parent (category) channel of this channel.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.CacheMode | mode | The Discord.CacheMode that determines whether the object should be fetched from cache. |
Discord.RequestOptions | options | The options to be used when sending the request. |