GuildChannel - truemedian/Discordia GitHub Wiki

Inherits Channel

Abstract base class that defines the base methods and/or properties for all Discord guild channels.

Methods

setName
setCategory
moveUp
moveDown
createInvite
getInvites
getPermissionOverwriteFor
delete

Properties

permissionOverwrites
name
position
guild
category

Inherited from Container
client
parent

Inherited from Snowflake
id
createdAt
timestamp

Inherited from Channel
type
mentionString

Methods

:setName( name )

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

Name Type
name string

Returns: boolean

:setCategory( id )

Sets the channel's parent category.

Name Type
id Channel ID Resolvable

Returns: boolean

:moveUp( n )

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.

Name Type
n number

Returns: boolean

:moveDown( n )

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.

Name Type
n number

Returns: boolean

:createInvite( payload )

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

Name Type
payload table

Returns: Invite

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

Returns: Cache

:getPermissionOverwriteFor( obj )

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.

Name Type
obj Role

Returns: PermissionOverwrite

:delete( )

Permanently deletes the channel. This cannot be undone!

Returns: boolean

Properties

.permissionOverwrites

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.

Type: Cache

.name

The name of the channel. This should be between 2 and 100 characters in length.

Type: string

.position

The position of the channel, where 0 is the highest.

Type: number

.guild

The guild in which this channel exists.

Type: Guild

.category

The parent channel category that may contain this channel.

Type: GuildCategoryChannel|nil

Inherited from Container

.client

A shortcut to the client object to which this container is visible.

Type: Client

.parent

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.

Type: Container|Client

Inherited from Snowflake

.id

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.

Type: string

.createdAt

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.

Type: number

.timestamp

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: string

Inherited from Channel

.type

The channel type. See the channelType enumeration for a human-readable representation.

Type: number

.mentionString

A string that, when included in a message content, may resolve as a link to a channel in the official Discord client.

Type: string

⚠️ **GitHub.com Fallback** ⚠️