Skip to content
SinisterRectus edited this page Dec 8, 2018 · 8 revisions

extends TextChannel

Represents a Discord group channel. Essentially a private channel that may have more than one and up to ten recipients. This class should only be relevant to user-accounts; bots cannot normally join group channels.

Instances of this class should not be constructed by users.

Properties Inherited From TextChannel

Name Type Description
messages WeakCache An iterable weak cache of all messages that are visible to the client. Messages that are not referenced elsewhere are eventually garbage collected. To access a message that may exist but is not cached, use TextChannel:getMessage.

Properties

Name Type Description
icon string/nil The hash for the channel's custom icon, if one is set.
iconURL string/nil The URL that can be used to view the channel's icon, if one is set.
name string The name of the channel.
owner User/nil Equivalent to GroupChannel.recipients:get(GroupChannel.ownerId).
ownerId string The Snowflake ID of the user that owns (created) the channel.
recipients SecondaryCache A secondary cache of users that are present in the channel.

Methods Inherited From TextChannel

broadcastTyping()

Indicates in the channel that the client's user "is typing".

Returns: boolean

getFirstMessage()

Returns the first message found in the channel, if any exist. This is not a cache shortcut; an HTTP request is made each time this method is called.

Returns: Message

getLastMessage()

Returns the last message found in the channel, if any exist. This is not a cache shortcut; an HTTP request is made each time this method is called.

Returns: Message

getMessage(id)

Parameter Type
id Message-ID-Resolvable

Gets a message object by ID. If the object is already cached, then the cached object will be returned; otherwise, an HTTP request is made.

Returns: Message

getMessages(limit)

Parameter Type Optional
limit number

Returns a newly constructed cache of between 1 and 100 (default = 50) message objects found in the channel. While the cache will never automatically gain or lose objects, the objects that it contains may be updated by gateway events.

Returns: SecondaryCache

getMessagesAfter(id, limit)

Parameter Type Optional
id Message-ID-Resolvable
limit number

Returns a newly constructed cache of between 1 and 100 (default = 50) message objects found in the channel after a specific id. While the cache will never automatically gain or lose objects, the objects that it contains may be updated by gateway events.

Returns: SecondaryCache

getMessagesAround(id, limit)

Parameter Type Optional
id Message-ID-Resolvable
limit number

Returns a newly constructed cache of between 1 and 100 (default = 50) message objects found in the channel around a specific point. While the cache will never automatically gain or lose objects, the objects that it contains may be updated by gateway events.

Returns: SecondaryCache

getMessagesBefore(id, limit)

Parameter Type Optional
id Message-ID-Resolvable
limit number

Returns a newly constructed cache of between 1 and 100 (default = 50) message objects found in the channel before a specific id. While the cache will never automatically gain or lose objects, the objects that it contains may be updated by gateway events.

Returns: SecondaryCache

getPinnedMessages()

Returns a newly constructed cache of up to 50 messages that are pinned in the channel. While the cache will never automatically gain or lose objects, the objects that it contains may be updated by gateway events.

Returns: SecondaryCache

send(content)

Parameter Type
content string/table

Sends a message to the channel. If content is a string, then this is simply sent as the message content. If it is a table, more advanced formatting is allowed. See managing messages for more information.

Returns: Message

sendf(content, ...)

Parameter Type
content string
... *

Sends a message to the channel with content formatted with ... via string.format

Returns: Message

Methods

addRecipient(id)

Parameter Type
id User-ID-Resolvable

Adds a user to the channel.

Returns: boolean

leave()

Removes the client's user from the channel. If no users remain, the channel is destroyed.

Returns: boolean

removeRecipient(id)

Parameter Type
id User-ID-Resolvable

Removes a user from the channel.

Returns: boolean

setIcon(icon)

Parameter Type
icon Base64-Resolvable

Sets the channel's icon. To remove the icon, pass nil.

Returns: boolean

setName(name)

Parameter Type
name string

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

Returns: boolean

Clone this wiki locally