DiscordLua
discorddiscord
v1.2.4
Install

MessageManager

Manager
On this page

MessageManager is the cache and REST facade for Message objects owned by the parent. Typical calls are fetch, create, edit, delete, resolve, and resolveId.

manager Module 1.2.4 Source

Constructor

MessageManager.new(client, channel, maxSize)

The class table is callable, so MessageManager(client, channel, maxSize) is the same as .new.

NameTypeRequiredBehavior
client any required Passed through to the implementation as written.
channel any required Passed through to the implementation as written.
maxSize any required Passed through to the implementation as written.
lua
local discord = require("discord")
local object = discord.MessageManager({}, {}, {})

Properties

MessageManager.channel

# readonly
Name
channel
Type
any
Access
readonly
Description
Channel this MessageManager belongs to, when resolved from cache.
Availability
Populated from the Gateway/REST payload or constructor for this MessageManager.

MessageManager.holds

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

MessageManager.maxSize

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

Methods

MessageManager:create()

#

Create a new resource through REST and cache the result.

Signature

MessageManager:create(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

MessageManager — the same instance, for chaining.

Example

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

MessageManager:crosspost()

#

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

Signature

MessageManager:crosspost(message)

Parameters

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

Returns

MessageManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a MessageManager
object:crosspost(message)

MessageManager:delete()

#

Permanently delete this resource through REST.

Signature

MessageManager:delete(message, callback)

Parameters

NameTypeRequiredBehavior
message 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

MessageManager — the same instance, for chaining.

Example

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

MessageManager:edit()

#

Apply a REST update to this resource.

Signature

MessageManager:edit(message, contentOrOptions, callback)

Parameters

NameTypeRequiredBehavior
message any required Passed through to the implementation as written.
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

MessageManager — the same instance, for chaining.

Example

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

MessageManager:endPoll()

#

Performs end poll on this MessageManager. Call it from bot code when you need that operation on the current object.

Signature

MessageManager:endPoll(message)

Parameters

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

Returns

MessageManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a MessageManager
object:endPoll(message)

MessageManager:fetch()

#

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

Signature

MessageManager:fetch(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

MessageManager — the same instance, for chaining.

Example

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

MessageManager:fetchPinned()

#

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

Signature

MessageManager:fetchPinned(callback)

Parameters

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

Returns

MessageManager — the same instance, for chaining.

Example

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

MessageManager:fetchPins()

#

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

Signature

MessageManager:fetchPins(callback)

Parameters

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

Returns

MessageManager — the same instance, for chaining.

Example

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

MessageManager:fetchPollAnswerVoters()

#

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

Signature

MessageManager:fetchPollAnswerVoters(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

MessageManager — the same instance, for chaining.

Example

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

MessageManager.forChannel()

# static

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

Signature

MessageManager.forChannel(client, channel, maxSize)

Parameters

NameTypeRequiredBehavior
client any required Passed through to the implementation as written.
channel any required Passed through to the implementation as written.
maxSize any required Passed through to the implementation as written.

Returns

MessageManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a MessageManager
MessageManager.forChannel(client, channel, maxSize)

MessageManager:pin()

#

Pin this message in its channel.

Signature

MessageManager:pin(message, callback)

Parameters

NameTypeRequiredBehavior
message 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

MessageManager — the same instance, for chaining.

Example

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

MessageManager:react()

#

Add an emoji reaction to this message.

Signature

MessageManager:react(message, emoji)

Parameters

NameTypeRequiredBehavior
message any required Passed through to the implementation as written.
emoji any required Passed through to the implementation as written.

Returns

MessageManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a MessageManager
object:react(message, emoji)

MessageManager:send()

#

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

Signature

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

MessageManager — the same instance, for chaining.

Example

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

MessageManager:unpin()

#

Remove this message from the channel pin list.

Signature

MessageManager:unpin(message, callback)

Parameters

NameTypeRequiredBehavior
message 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

MessageManager — the same instance, for chaining.

Example

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

Static members

  • MessageManager.DMMessageManager
  • MessageManager.GuildMessageManager
  • MessageManager.PartialGroupDMMessageManager

Examples

lua
local discord = require("discord")
local object = discord.MessageManager({})

ApplicationCommandManager · ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc