Interface IGuildChannel
Represents a generic guild channel.
Inherited Members
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public interface IGuildChannel : IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable
Properties
| Improve this Doc View SourceFlags
Gets the flags related to this channel.
Declaration
ChannelFlags Flags { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
IGuild Guild { get; }
Property Value
Type | Description |
---|---|
IGuild | A guild object that this channel belongs to. |
GuildId
Gets the guild ID associated with this channel.
Declaration
ulong GuildId { get; }
Property Value
Type | Description |
---|---|
UInt64 | An |
PermissionOverwrites
Gets a collection of permission overwrites for this channel.
Declaration
IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<Overwrite> | A collection of overwrites associated with this channel. |
Position
Gets the position of this channel.
Declaration
int Position { get; }
Property Value
Type | Description |
---|---|
Int32 | An |
Methods
| Improve this Doc View SourceAddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)
Adds or updates the permission overwrite for the given role.
Declaration
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 |
---|---|
Task | A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
Examples
The following example fetches a role via GetRole(UInt64) and a channel via GetChannelAsync(UInt64, CacheMode, RequestOptions). Next, it checks if an overwrite had already been set via GetPermissionOverwrite(IRole); if not, it denies the role from sending any messages to the channel.
|
Improve this Doc
View Source
AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)
Adds or updates the permission overwrite for the given user.
Declaration
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 |
---|---|
Task | A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
Examples
The following example fetches a user via GetUserAsync(UInt64, CacheMode, RequestOptions) and a channel via GetChannelAsync(UInt64, CacheMode, RequestOptions). Next, it checks if an overwrite had already been set via GetPermissionOverwrite(IUser); if not, it denies the user from sending any messages to the channel.
|
Improve this Doc
View Source
GetPermissionOverwrite(IRole)
Gets the permission overwrite for a specific role.
Declaration
OverwritePermissions? GetPermissionOverwrite(IRole role)
Parameters
Type | Name | Description |
---|---|---|
IRole | role | The role to get the overwrite from. |
Returns
Type | Description |
---|---|
Nullable<OverwritePermissions> | An overwrite object for the targeted role; |
GetPermissionOverwrite(IUser)
Gets the permission overwrite for a specific user.
Declaration
OverwritePermissions? GetPermissionOverwrite(IUser user)
Parameters
Type | Name | Description |
---|---|---|
IUser | user | The user to get the overwrite from. |
Returns
Type | Description |
---|---|
Nullable<OverwritePermissions> | An overwrite object for the targeted user; |
GetUserAsync(UInt64, CacheMode, RequestOptions)
Gets a user in this channel.
Declaration
Task<IGuildUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
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 |
---|---|
Task<IGuildUser> | A task representing the asynchronous get operation. The task result contains a guild user object that
represents the user; |
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>> GetUsersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
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 |
---|---|
IAsyncEnumerable<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.
ModifyAsync(Action<GuildChannelProperties>, RequestOptions)
Modifies this guild channel.
Declaration
Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
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 |
---|---|
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
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 |
---|---|
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
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 |
---|---|
Task | A task representing the asynchronous operation for removing the specified permissions from the channel. |