MessageCollector
collectorOn this page
MessageCollector is a DiscordLua collector representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Constructor
MessageCollector.new(channel, options) The class table is callable, so MessageCollector(channel, options) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
channel |
any |
required | Passed through to the implementation as written. |
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
local discord = require("discord")
local object = discord.MessageCollector({}, {})Properties
- Name
channel- Type
any- Access
- readonly
- Description
- Channel this MessageCollector belongs to, when resolved from cache.
- Availability
- Populated from the Gateway/REST payload or constructor for this MessageCollector.
- Name
options- Type
any- Access
- readonly
- Description
- Instance field
MessageCollector.options. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this MessageCollector.
- Name
received- Type
any- Access
- readonly
- Description
- Instance field
MessageCollector.received. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this MessageCollector.
Methods
MessageCollector:collect()
#Performs collect on this MessageCollector. Call it from bot code when you need that operation on the current object.
Signature
MessageCollector:collect(message) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
message |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a MessageCollector
object:collect(message)Examples
local discord = require("discord")
local object = discord.MessageCollector({})Related APIs
Collector · InteractionCollector · ReactionCollector
Version: discord 1.2.4 · runtime 1.0.0