Class RestGuildChannel
Represents a private REST-based group channel.
Inherited Members
Namespace: Discord.Rest
Assembly: Discord.Net.Rest.dll
Syntax
public class RestGuildChannel : RestChannel, IUpdateable, IGuildChannel, IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable
Properties
| Improve this Doc View SourceGuildId
Gets the guild ID associated with this channel.
Declaration
public ulong GuildId { get; }
Property Value
| Type | Description |
|---|---|
| System.UInt64 | An System.UInt64 representing the guild snowflake identifier for the guild that this channel belongs to. |
Name
Gets the name of this channel.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String | A string containing the name of this channel. |
PermissionOverwrites
Gets a collection of permission overwrites for this channel.
Declaration
public virtual IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<Overwrite> | A collection of overwrites associated with this channel. |
Position
Gets the position of this channel.
Declaration
public int Position { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | An System.Int32 representing the position of this channel in the guild's channel list relative to others of the same type. |
Methods
| Improve this Doc View SourceAddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)
Adds or updates the permission overwrite for the given role.
Declaration
public virtual Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IRole | role | The role to add the overwrite to. |
| OverwritePermissions | permissions | The overwrite to add to the role. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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.
Declaration
public virtual Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to add the overwrite to. |
| OverwritePermissions | permissions | The overwrite to add to the user. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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.
Declaration
public Task DeleteAsync(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
GetPermissionOverwrite(IRole)
Gets the permission overwrite for a specific role.
Declaration
public virtual OverwritePermissions? GetPermissionOverwrite(IRole role)
Parameters
| Type | Name | Description |
|---|---|---|
| IRole | role | The role to get the overwrite from. |
Returns
| Type | Description |
|---|---|
| System.Nullable<OverwritePermissions> | An overwrite object for the targeted role; |
GetPermissionOverwrite(IUser)
Gets the permission overwrite for a specific user.
Declaration
public virtual OverwritePermissions? GetPermissionOverwrite(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to get the overwrite from. |
Returns
| Type | Description |
|---|---|
| System.Nullable<OverwritePermissions> | An overwrite object for the targeted user; |
ModifyAsync(Action<GuildChannelProperties>, RequestOptions)
Modifies this guild channel.
Declaration
public Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action<GuildChannelProperties> | func | The delegate containing the properties to modify the channel with. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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.
Declaration
public virtual Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IRole | role | The role to remove the overwrite from. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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.
Declaration
public virtual Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to remove the overwrite from. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task representing the asynchronous operation for removing the specified permissions from the channel. |
ToString()
Gets the name of this channel.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A string that is the name of this channel. |
Overrides
UpdateAsync(RequestOptions)
Updates this object's properties with its current state.
Declaration
public override Task UpdateAsync(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)
Gets a user in this channel.
Declaration
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | The snowflake identifier of the user (e.g. |
| CacheMode | mode | The CacheMode that determines whether the object should be fetched from cache. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUser> | A task that represents the asynchronous get operation. The task result contains a user object that
represents the found user; |
IChannel.GetUsersAsync(CacheMode, RequestOptions)
Gets a collection of users that are able to view the channel or are currently in this channel.
Declaration
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| CacheMode | mode | The CacheMode that determines whether the object should be fetched from cache. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IUser>> | 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.
1000, the request will be split into 3 individual requests; thus returning 53individual asynchronous
responses, hence the need of flattening.
IGuildChannel.AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)
Adds or updates the permission overwrite for the given role.
Declaration
Task IGuildChannel.AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| IRole | role | The role to add the overwrite to. |
| OverwritePermissions | permissions | The overwrite to add to the role. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
IGuildChannel.AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)
Adds or updates the permission overwrite for the given user.
Declaration
Task IGuildChannel.AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to add the overwrite to. |
| OverwritePermissions | permissions | The overwrite to add to the user. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
IGuildChannel.GetPermissionOverwrite(IRole)
Gets the permission overwrite for a specific role.
Declaration
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role)
Parameters
| Type | Name | Description |
|---|---|---|
| IRole | role | The role to get the overwrite from. |
Returns
| Type | Description |
|---|---|
| System.Nullable<OverwritePermissions> | An overwrite object for the targeted role; |
IGuildChannel.GetPermissionOverwrite(IUser)
Gets the permission overwrite for a specific user.
Declaration
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to get the overwrite from. |
Returns
| Type | Description |
|---|---|
| System.Nullable<OverwritePermissions> | An overwrite object for the targeted user; |
IGuildChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)
Gets a user in this channel.
Declaration
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | The snowflake identifier of the user. |
| CacheMode | mode | The CacheMode that determines whether the object should be fetched from cache. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IGuildUser> | A task representing the asynchronous get operation. The task result contains a guild user object that
represents the user; |
IGuildChannel.GetUsersAsync(CacheMode, RequestOptions)
Gets a collection of users that are able to view the channel or are currently in this channel.
Declaration
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| CacheMode | mode | The CacheMode that determines whether the object should be fetched from cache. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IGuildUser>> | Paged collection of users. |
Remarks
This method follows the same behavior as described in GetUsersAsync(CacheMode, RequestOptions). Please visit its documentation for more details on this method.
IGuildChannel.Guild
Gets the guild associated with this channel.
Declaration
IGuild IGuildChannel.Guild { get; }
Returns
| Type | Description |
|---|---|
| IGuild | A guild object that this channel belongs to. |
IGuildChannel.RemovePermissionOverwriteAsync(IRole, RequestOptions)
Removes the permission overwrite for the given role, if one exists.
Declaration
Task IGuildChannel.RemovePermissionOverwriteAsync(IRole role, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| IRole | role | The role to remove the overwrite from. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task representing the asynchronous operation for removing the specified permissions from the channel. |
IGuildChannel.RemovePermissionOverwriteAsync(IUser, RequestOptions)
Removes the permission overwrite for the given user, if one exists.
Declaration
Task IGuildChannel.RemovePermissionOverwriteAsync(IUser user, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to remove the overwrite from. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task representing the asynchronous operation for removing the specified permissions from the channel. |