Skip to content
SinisterRectus edited this page Nov 16, 2019 · 17 revisions

extends Channel

Defines the base methods and properties for all Discord guild channels.

This is an abstract base class. Direct instances should never exist.

Properties Inherited From Channel

Name Type Description
client Client A shortcut to the client object to which this container is visible.
createdAt number The Unix time in seconds at which this object was created by Discord. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate. Equivalent to Date.parseSnowflake(Snowflake.id).
id string The Snowflake ID that can be used to identify the object. This is guaranteed to be unique except in cases where an object shares the ID of its parent.
mentionString string A string that, when included in a message content, may resolve as a link to a channel in the official Discord client.
parent Container/Client The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists.
timestamp string The date and time at which this object was created by Discord, represented as an ISO 8601 string plus microseconds when available. Equivalent to Date.fromSnowflake(Snowflake.id):toISO().
type number The channel type. See the channelType enumeration for a human-readable representation.

Properties

Name Type Description
category GuildCategoryChannel/nil The parent channel category that may contain this channel.
guild Guild The guild in which this channel exists.
name string The name of the channel. This should be between 2 and 100 characters in length.
permissionOverwrites Cache An iterable cache of all overwrites that exist in this channel. To access an overwrite that may exist, but is not cached, use GuildChannel:getPermissionOverwriteFor.
position number The position of the channel, where 0 is the highest.
private boolean Whether the "everyone" role has permission to view this channel. In the Discord channel, private text channels are indicated with a lock icon and private voice channels are not visible.

Methods Inherited From Channel

__eq()

Defines the behavior of the == operator. Allows containers to be directly compared according to their type and __hash return values.

Returns: boolean


__hash()

Returns Snowflake.id

Returns: string


__tostring()

Defines the behavior of the tostring function. All containers follow the format ClassName: hash.

Returns: string


getDate()

Returns a unique Date object that represents when the object was created by Discord. Equivalent to Date.fromSnowflake(Snowflake.id)

This method only operates on data in memory.

Returns: Date


Methods

createInvite(payload)

Parameter Type Optional
payload table

Creates an invite to the channel. Optional payload fields are: max_age: number time in seconds until expiration, default = 86400 (24 hours), max_uses: number total number of uses allowed, default = 0 (unlimited), temporary: boolean whether the invite grants temporary membership, default = false, unique: boolean whether a unique code should be guaranteed, default = false

This method always makes an HTTP request.

Returns: Invite


delete()

Permanently deletes the channel. This cannot be undone!

This method always makes an HTTP request.

Returns: boolean


getInvites()

Returns a newly constructed cache of all invite objects for the channel. The cache and its objects are not automatically updated via gateway events. You must call this method again to get the updated objects.

This method always makes an HTTP request.

Returns: Cache


getPermissionOverwriteFor(obj)

Parameter Type
obj Role/Member

Returns a permission overwrite object corresponding to the provided member or role object. If a cached overwrite is not found, an empty overwrite with zero-permissions is returned instead. Therefore, this can be used to create a new overwrite when one does not exist. Note that the member or role must exist in the same guild as the channel does.

This method only operates on data in memory.

Returns: PermissionOverwrite


moveDown(n)

Parameter Type
n number

Moves a channel down its list. The parameter n indicates how many spaces the channel should be moved, clamped to the lowest position, with a default of 1 if it is omitted. This will also normalize the positions of all channels.

This method always makes an HTTP request.

Returns: boolean


moveUp(n)

Parameter Type
n number

Moves a channel up its list. The parameter n indicates how many spaces the channel should be moved, clamped to the highest position, with a default of 1 if it is omitted. This will also normalize the positions of all channels.

This method always makes an HTTP request.

Returns: boolean


setCategory(id)

Parameter Type
id Channel-ID-Resolvable

Sets the channel's parent category.

This method always makes an HTTP request.

Returns: boolean


setName(name)

Parameter Type
name string

Sets the channel's name. This must be between 2 and 100 characters in length.

This method always makes an HTTP request.

Returns: boolean


Clone this wiki locally