Search Results for

    Show / Hide Table of Contents

    Interface IChannel

    Represents a generic channel.

    Inherited Members
    ISnowflakeEntity.CreatedAt
    IEntity<UInt64>.Id
    Namespace: Discord
    Assembly: Discord.Net.Core.dll
    Syntax
    public interface IChannel : ISnowflakeEntity, IEntity<ulong>

    Properties

    | Improve this Doc View Source

    Name

    Gets the name of this channel.

    Declaration
    string Name { get; }
    Property Value
    Type Description
    String

    A string containing the name of this channel.

    Methods

    | Improve this Doc View Source

    GetUserAsync(UInt64, CacheMode, RequestOptions)

    Gets a user in this channel.

    Declaration
    Task<IUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier of the user (e.g. 168693960628371456).

    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<IUser>

    A task that represents the asynchronous get operation. The task result contains a user object that represents the found user; null if none is found.

    | Improve this Doc View Source

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

    This method will attempt to fetch all users that is able to view this channel or is currently in this channel. The library will attempt to split up the requests according to and MaxUsersPerBatch. In other words, if there are 3000 users, and the MaxUsersPerBatch constant is 1000, the request will be split into 3 individual requests; thus returning 53individual asynchronous responses, hence the need of flattening.

    Extension Methods

    ChannelExtensions.GetChannelType(IChannel)

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.9.0