BitField
bitfieldOn this page
BitField is a DiscordLua bitfield representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Constructor
BitField.new(bits) The class table is callable, so BitField(bits) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
bits |
any |
required | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.BitField({})Properties
- Name
bitfield- Type
any- Access
- readonly
- Description
- Instance field
BitField.bitfield. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this BitField.
- Name
flags- Type
any- Access
- readonly
- Description
- Instance field
BitField.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 BitField.
- Name
frozen- Type
any- Access
- readonly
- Description
- Instance field
BitField.frozen. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this BitField.
Methods
BitField:add()
#Add an item to this BitField.
Signature
BitField:add(...) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
... |
any |
required | Passed through to the implementation as written. |
Returns
BitField — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a BitField
object:add(...)BitField:any()
#Performs any on this BitField. Call it from bot code when you need that operation on the current object.
Signature
BitField:any(bit) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
bit |
any |
required | Passed through to the implementation as written. |
Returns
BitField — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a BitField
object:any(bit)BitField:clone()
#Performs clone on this BitField. Call it from bot code when you need that operation on the current object.
Signature
BitField:clone() Parameters
No parameters.
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
object:clone()BitField:equals()
#Return whether this BitField refers to the same resource as the argument.
Signature
BitField:equals(other) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
other |
any |
required | Passed through to the implementation as written. |
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
object:equals(other)BitField:freeze()
#Performs freeze on this BitField. Call it from bot code when you need that operation on the current object.
Signature
BitField:freeze() Parameters
No parameters.
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
object:freeze()BitField:has()
#Performs has on this BitField. Call it from bot code when you need that operation on the current object.
Signature
BitField:has(bit) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
bit |
any |
required | Passed through to the implementation as written. |
Returns
BitField — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a BitField
object:has(bit)BitField:missing()
#Performs missing on this BitField. Call it from bot code when you need that operation on the current object.
Signature
BitField:missing(bit) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
bit |
any |
required | Passed through to the implementation as written. |
Returns
BitField — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a BitField
object:missing(bit)BitField:remove()
#Remove an item from this BitField.
Signature
BitField:remove(...) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
... |
any |
required | Passed through to the implementation as written. |
Returns
BitField — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a BitField
object:remove(...)Resolve a snowflake, object, or mention to a cached instance.
Signature
BitField.resolve(bit) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
bit |
any |
required | Passed through to the implementation as written. |
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
BitField.resolve(bit)BitField:serialize()
#Performs serialize on this BitField. Call it from bot code when you need that operation on the current object.
Signature
BitField:serialize() Parameters
No parameters.
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
object:serialize()BitField:toArray()
#Performs to array on this BitField. Call it from bot code when you need that operation on the current object.
Signature
BitField:toArray() Parameters
No parameters.
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
object:toArray()BitField:toJSON()
#Serialize this BitField into a Lua table suitable for REST or debugging.
Signature
BitField:toJSON() Parameters
No parameters.
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
object:toJSON()BitField:valueOf()
#function valueOf() { [native code] }
Signature
BitField:valueOf() Parameters
No parameters.
Returns
BitField — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a BitField
object:valueOf()Static members
-
BitField.Flags
Examples
local discord = require("discord")
local object = discord.BitField({})Related APIs
ActivityFlagsBitField · ApplicationFlagsBitField · AttachmentFlagsBitField · ChannelFlagsBitField · GuildMemberFlagsBitField · IntentsBitField · InviteFlagsBitField · MessageFlagsBitField
Version: discord 1.2.4 · runtime 1.0.0