DiscordLua
discorddiscord
v1.2.4
Install

Channel

channel
On this page

Channel is the base type for Discord channels. Typed subclasses add send, voice, thread, and forum behavior. Delete a channel with :delete.

channel Module 1.2.4 Source

Properties

Channel.appliedTags

# readonly
Name
appliedTags
Type
any
Access
readonly
Description
Instance field Channel.appliedTags. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.archiveTimestamp

# readonly
Name
archiveTimestamp
Type
any
Access
readonly
Description
Instance field Channel.archiveTimestamp. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.archived

# readonly
Name
archived
Type
any
Access
readonly
Description
Instance field Channel.archived. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.autoArchiveDuration

# readonly
Name
autoArchiveDuration
Type
any
Access
readonly
Description
Instance field Channel.autoArchiveDuration. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.availableTags

# readonly
Name
availableTags
Type
Collection
Access
readonly
Description
Instance field Channel.availableTags. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.
Related
Collection

Channel.bitrate

# readonly
Name
bitrate
Type
any
Access
readonly
Description
Instance field Channel.bitrate. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.children

# readonly
Name
children
Type
CategoryChannelChildManager
Access
readonly
Description
Cache and REST facade for categorychannelchild objects owned by this Channel. Use it to fetch, create, resolve, and mutate those resources.
Availability
Created in Channel.new and remains valid for the lifetime of the Channel.
Related
CategoryChannelChildManager

Channel.client

# readonly
Name
client
Type
any
Access
readonly
Description
Owning Client instance used for REST, cache, and event dispatch.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.defaultAutoArchiveDuration

# mutable
Name
defaultAutoArchiveDuration
Type
any
Access
mutable
Description
Instance field Channel.defaultAutoArchiveDuration. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.defaultForumLayout

# readonly
Name
defaultForumLayout
Type
any
Access
readonly
Description
Instance field Channel.defaultForumLayout. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.defaultReactionEmoji

# readonly
Name
defaultReactionEmoji
Type
any
Access
readonly
Description
Instance field Channel.defaultReactionEmoji. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.defaultSortOrder

# readonly
Name
defaultSortOrder
Type
any
Access
readonly
Description
Instance field Channel.defaultSortOrder. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.defaultThreadRateLimitPerUser

# readonly
Name
defaultThreadRateLimitPerUser
Type
any
Access
readonly
Description
Instance field Channel.defaultThreadRateLimitPerUser. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.flags

# readonly
Name
flags
Type
any
Access
readonly
Description
Instance field Channel.flags. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.guildId

# readonly
Name
guildId
Type
any
Access
readonly
Description
Instance field Channel.guildId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.icon

# readonly
Name
icon
Type
any
Access
readonly
Description
Instance field Channel.icon. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.id

# readonly
Name
id
Type
any
Access
readonly
Description
Snowflake id of this Channel.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.invitable

# readonly
Name
invitable
Type
any
Access
readonly
Description
Instance field Channel.invitable. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.invites

# readonly
Name
invites
Type
GuildInviteManager
Access
readonly
Description
Cache and REST facade for guildinvite objects owned by this Channel. Use it to fetch, create, resolve, and mutate those resources.
Availability
Created in Channel.new and remains valid for the lifetime of the Channel.
Related
GuildInviteManager

Channel.lastMessageId

# readonly
Name
lastMessageId
Type
any
Access
readonly
Description
Instance field Channel.lastMessageId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.lastPinTimestamp

# readonly
Name
lastPinTimestamp
Type
any
Access
readonly
Description
Instance field Channel.lastPinTimestamp. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.locked

# readonly
Name
locked
Type
any
Access
readonly
Description
Instance field Channel.locked. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.memberCount

# readonly
Name
memberCount
Type
any
Access
readonly
Description
Instance field Channel.memberCount. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.members

# readonly
Name
members
Type
threadMembers
Access
readonly
Description
Instance field Channel.members. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.messageCount

# readonly
Name
messageCount
Type
any
Access
readonly
Description
Instance field Channel.messageCount. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.messages

# readonly
Name
messages
Type
messageManager
Access
readonly
Description
Cache and REST facade for message objects owned by this Channel. Use it to fetch, create, resolve, and mutate those resources.
Availability
Created in Channel.new and remains valid for the lifetime of the Channel.

Channel.name

# mutable
Name
name
Type
any
Access
mutable
Description
Display name of this Channel.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.nsfw

# readonly
Name
nsfw
Type
any
Access
readonly
Description
Instance field Channel.nsfw. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.ownerId

# readonly
Name
ownerId
Type
any
Access
readonly
Description
Instance field Channel.ownerId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.parentId

# readonly
Name
parentId
Type
any
Access
readonly
Description
Instance field Channel.parentId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.permissionOverwrites

# readonly
Name
permissionOverwrites
Type
overwriteManager
Access
readonly
Description
Cache and REST facade for overwrite objects owned by this Channel. Use it to fetch, create, resolve, and mutate those resources.
Availability
Created in Channel.new and remains valid for the lifetime of the Channel.

Channel.position

# mutable
Name
position
Type
any
Access
mutable
Description
Instance field Channel.position. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.rateLimitPerUser

# mutable
Name
rateLimitPerUser
Type
any
Access
mutable
Description
Instance field Channel.rateLimitPerUser. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.raw

# readonly
Name
raw
Type
any
Access
readonly
Description
Instance field Channel.raw. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.recipient

# readonly
Name
recipient
Type
UserMod
Access
readonly
Description
Instance field Channel.recipient. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.recipientId

# readonly
Name
recipientId
Type
any
Access
readonly
Description
Instance field Channel.recipientId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.recipientIds

# readonly
Name
recipientIds
Type
any
Access
readonly
Description
Instance field Channel.recipientIds. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.recipients

# readonly
Name
recipients
Type
any
Access
readonly
Description
Instance field Channel.recipients. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.rtcRegion

# readonly
Name
rtcRegion
Type
any
Access
readonly
Description
Instance field Channel.rtcRegion. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.threads

# readonly
Name
threads
Type
GuildTextThreadManager
Access
readonly
Description
Cache and REST facade for guildtextthread objects owned by this Channel. Use it to fetch, create, resolve, and mutate those resources.
Availability
Created in Channel.new and remains valid for the lifetime of the Channel.
Related
GuildTextThreadManager

Channel.topic

# mutable
Name
topic
Type
any
Access
mutable
Description
Instance field Channel.topic. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.totalMessageSent

# readonly
Name
totalMessageSent
Type
any
Access
readonly
Description
Instance field Channel.totalMessageSent. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.type

# mutable
Name
type
Type
any
Access
mutable
Description
Instance field Channel.type. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.userLimit

# readonly
Name
userLimit
Type
any
Access
readonly
Description
Instance field Channel.userLimit. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Channel.videoQualityMode

# readonly
Name
videoQualityMode
Type
any
Access
readonly
Description
Instance field Channel.videoQualityMode. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Channel.

Methods

Channel:addFollower()

#

Add Follower to this Channel.

Signature

Channel:addFollower(targetChannel, callback)

Parameters

NameTypeRequiredBehavior
targetChannel any required Passed through to the implementation as written.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:addFollower(targetChannel, function(err, result)
    if err then error(err) end
end)

Channel:awaitMessageComponent()

#

Performs await message component on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:awaitMessageComponent(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Channel
object:awaitMessageComponent({}, function(err, result)
    if err then error(err) end
end)

Channel:awaitMessages()

#

Performs await messages on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:awaitMessages(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Channel
object:awaitMessages({}, function(err, result)
    if err then error(err) end
end)

Channel:bulkDelete()

#

Delete many messages in this channel through REST.

Signature

Channel:bulkDelete(messages, filterOld, callback)

Parameters

NameTypeRequiredBehavior
messages any required Passed through to the implementation as written.
filterOld any required Passed through to the implementation as written.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Channel
object:bulkDelete(messages, filterOld, function(err, result)
    if err then error(err) end
end)

Channel:clone()

#

Performs clone on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:clone(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:clone({}, function(err, result)
    if err then error(err) end
end)

Channel:createdAt()

#

Create dAt through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Channel:createdAt()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:createdAt()

Channel:createdTimestamp()

#

Create dTimestamp through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Channel:createdTimestamp()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:createdTimestamp()

Channel:createInteractionCollector()

#

Create InteractionCollector through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Channel:createInteractionCollector(options)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:createInteractionCollector({})

Channel:createInvite()

#

Create Invite through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Channel:createInvite(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:createInvite({}, function(err, result)
    if err then error(err) end
end)

Channel:createMessageCollector()

#

Create MessageCollector through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Channel:createMessageCollector(options)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:createMessageCollector({})

Channel:createMessageComponentCollector()

#

Create MessageComponentCollector through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Channel:createMessageComponentCollector(options)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:createMessageComponentCollector({})

Channel:createWebhook()

#

Create Webhook through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Channel:createWebhook(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:createWebhook({}, function(err, result)
    if err then error(err) end
end)

Channel:deletable()

#

Performs deletable on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:deletable()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:deletable()

Channel:delete()

#

Permanently delete this resource through REST.

Signature

Channel:delete(reason, callback)

Parameters

NameTypeRequiredBehavior
reason string optional Audit-log reason sent as X-Audit-Log-Reason on REST mutations.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:delete(reason, function(err, result)
    if err then error(err) end
end)

Channel:edit()

#

Apply a REST update to this resource.

Signature

Channel:edit(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:edit({}, function(err, result)
    if err then error(err) end
end)

Channel:equals()

#

Return whether this Channel refers to the same resource as the argument.

Signature

Channel:equals(other)

Parameters

NameTypeRequiredBehavior
other any required Passed through to the implementation as written.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:equals(other)

Channel:fetch()

#

Request a fresh copy of this resource from REST and update the cache.

Signature

Channel:fetch(callback)

Parameters

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:fetch(function(err, result)
    if err then error(err) end
end)

Channel:fetchInvites()

#

Fetch Invites from REST and update the local cache when the request succeeds.

Signature

Channel:fetchInvites(callback)

Parameters

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:fetchInvites(function(err, result)
    if err then error(err) end
end)

Channel:fetchMessages()

#

Fetch Messages from REST and update the local cache when the request succeeds.

Signature

Channel:fetchMessages(limitOrOptions, callback)

Parameters

NameTypeRequiredBehavior
limitOrOptions table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:fetchMessages({}, function(err, result)
    if err then error(err) end
end)

Channel:fetchWebhooks()

#

Fetch Webhooks from REST and update the local cache when the request succeeds.

Signature

Channel:fetchWebhooks(callback)

Parameters

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:fetchWebhooks(function(err, result)
    if err then error(err) end
end)

Channel:guild()

#

Performs guild on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:guild()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:guild()

Channel:iconURL()

#

Performs icon url on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:iconURL(options)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:iconURL({})

Channel:isDMBased()

#

Predicate that returns whether this Channel matches isDMBased. Use it to branch before calling type-specific methods.

Signature

Channel:isDMBased()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:isDMBased()

Channel:isSendable()

#

Predicate that returns whether this Channel matches isSendable. Use it to branch before calling type-specific methods.

Signature

Channel:isSendable()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:isSendable()

Channel:isTextBased()

#

Predicate that returns whether this Channel matches isTextBased. Use it to branch before calling type-specific methods.

Signature

Channel:isTextBased()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:isTextBased()

Channel:isThread()

#

Predicate that returns whether this Channel matches isThread. Use it to branch before calling type-specific methods.

Signature

Channel:isThread()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:isThread()

Channel:isThreadOnly()

#

Predicate that returns whether this Channel matches isThreadOnly. Use it to branch before calling type-specific methods.

Signature

Channel:isThreadOnly()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:isThreadOnly()

Channel:isVoiceBased()

#

Predicate that returns whether this Channel matches isVoiceBased. Use it to branch before calling type-specific methods.

Signature

Channel:isVoiceBased()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:isVoiceBased()

Channel:lastMessage()

#

Performs last message on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:lastMessage()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:lastMessage()

Channel:lastPinAt()

#

Performs last pin at on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:lastPinAt()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:lastPinAt()

Channel:lockPermissions()

#

Copy the parent category permission overwrites onto this channel.

Signature

Channel:lockPermissions(callback)

Parameters

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a Channel
object:lockPermissions(function(err, result)
    if err then error(err) end
end)

Channel:manageable()

#

Performs manageable on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:manageable()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:manageable()

Channel:parent()

#

Performs parent on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:parent()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:parent()

Channel:partial()

#

Performs partial on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:partial()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:partial()

Channel:permissionsFor()

#

Performs permissions for on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:permissionsFor(memberOrRole, checkAdmin)

Parameters

NameTypeRequiredBehavior
memberOrRole any required Passed through to the implementation as written.
checkAdmin any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Channel
object:permissionsFor(memberOrRole, checkAdmin)

Channel:permissionsLocked()

#

Performs permissions locked on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:permissionsLocked()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:permissionsLocked()

Channel:rawPosition()

#

Performs raw position on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:rawPosition()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:rawPosition()

Channel:send()

#

Send a message, payload, or packet using this object.

Signature

Channel:send(contentOrOptions, callback)

Parameters

NameTypeRequiredBehavior
contentOrOptions table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:send("Hello", function(err, result)
    if err then error(err) end
end)

Channel:sendTyping()

#

Send Typing using this Channel.

Signature

Channel:sendTyping()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:sendTyping()

Channel:setDefaultAutoArchiveDuration()

#

Set the DefaultAutoArchiveDuration field. Builders return this Channel so setters can be chained.

Signature

Channel:setDefaultAutoArchiveDuration(duration)

Parameters

NameTypeRequiredBehavior
duration any required Passed through to the implementation as written.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setDefaultAutoArchiveDuration(duration)

Channel:setName()

#

Set the Name field. Builders return this Channel so setters can be chained.

Signature

Channel:setName(name)

Parameters

NameTypeRequiredBehavior
name any required Passed through to the implementation as written.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setName(name)

Channel:setNSFW()

#

Set the NSFW field. Builders return this Channel so setters can be chained.

Signature

Channel:setNSFW(nsfw)

Parameters

NameTypeRequiredBehavior
nsfw any required Passed through to the implementation as written.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setNSFW(nsfw)

Channel:setParent()

#

Set the Parent field. Builders return this Channel so setters can be chained.

Signature

Channel:setParent(parentId)

Parameters

NameTypeRequiredBehavior
parentId string required Snowflake id string.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setParent("123")

Channel:setPosition()

#

Set the Position field. Builders return this Channel so setters can be chained.

Signature

Channel:setPosition(position)

Parameters

NameTypeRequiredBehavior
position any required Passed through to the implementation as written.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setPosition(position)

Channel:setRateLimitPerUser()

#

Set the RateLimitPerUser field. Builders return this Channel so setters can be chained.

Signature

Channel:setRateLimitPerUser(seconds, callback)

Parameters

NameTypeRequiredBehavior
seconds any required Passed through to the implementation as written.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setRateLimitPerUser(seconds, function(err, result)
    if err then error(err) end
end)

Channel:setSlowmode()

#

Set the Slowmode field. Builders return this Channel so setters can be chained.

Signature

Channel:setSlowmode(seconds, callback)

Parameters

NameTypeRequiredBehavior
seconds any required Passed through to the implementation as written.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setSlowmode(seconds, function(err, result)
    if err then error(err) end
end)

Channel:setTopic()

#

Set the Topic field. Builders return this Channel so setters can be chained.

Signature

Channel:setTopic(topic)

Parameters

NameTypeRequiredBehavior
topic any required Passed through to the implementation as written.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setTopic(topic)

Channel:setType()

#

Set the Type field. Builders return this Channel so setters can be chained.

Signature

Channel:setType(channelType)

Parameters

NameTypeRequiredBehavior
channelType any required Passed through to the implementation as written.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:setType(channelType)

Channel:startTyping()

#

Performs start typing on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:startTyping(callback)

Parameters

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:startTyping(function(err, result)
    if err then error(err) end
end)

Channel:toJSON()

#

Serialize this Channel into a Lua table suitable for REST or debugging.

Signature

Channel:toJSON()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:toJSON()

Channel:toString()

#

function toString() { [native code] }

Signature

Channel:toString()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:toString()

Channel:url()

#

Performs url on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:url()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:url()

Channel:viewable()

#

Performs viewable on this Channel. Call it from bot code when you need that operation on the current object.

Signature

Channel:viewable()

Parameters

No parameters.

Returns

Channel — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Channel
object:viewable()

Static members

  • Channel.AnnouncementChannel
  • Channel.BaseGuildTextChannel
  • Channel.BaseGuildVoiceChannel
  • Channel.CategoryChannel
  • Channel.DMChannel
  • Channel.DirectoryChannel
  • Channel.ForumChannel
  • Channel.GuildChannel
  • Channel.MediaChannel
  • Channel.NewsChannel
  • Channel.PartialGroupDMChannel
  • Channel.StageChannel
  • Channel.TextChannel
  • Channel.ThreadChannel
  • Channel.ThreadOnlyChannel
  • Channel.VoiceChannel

Examples

Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.

BaseGuildTextChannel · BaseGuildVoiceChannel · CategoryChannel · DirectoryChannel · DMChannel · ForumChannel · GuildChannel · MediaChannel

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc