DiscordLua
discorddiscord
v1.2.4
Install

Webhook

Class
On this page

Webhook is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.

class Module 1.2.4 Source

Properties

Webhook.applicationId

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

Webhook.avatar

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

Webhook.channelId

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

Webhook.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 Webhook.

Webhook.guildId

# readonly
Name
guildId
Type
any
Access
readonly
Description
Instance field Webhook.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 Webhook.

Webhook.id

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

Webhook.name

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

Webhook.owner

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

Webhook.raw

# readonly
Name
raw
Type
any
Access
readonly
Description
Instance field Webhook.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 Webhook.

Webhook.sourceChannel

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

Webhook.sourceGuild

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

Webhook.token

# readonly
Name
token
Type
any
Access
readonly
Description
Authentication token held by this Webhook. Do not log this value.
Availability
Set by login. Do not log this value.

Webhook.type

# readonly
Name
type
Type
any
Access
readonly
Description
Instance field Webhook.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 Webhook.

Webhook.url

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

Methods

Webhook:avatarURL()

#

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

Signature

Webhook:avatarURL(options)

Parameters

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

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:avatarURL({})

Webhook:channel()

#

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

Signature

Webhook:channel()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:channel()

Webhook:createdAt()

#

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

Signature

Webhook:createdAt()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

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

Webhook:createdTimestamp()

#

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

Signature

Webhook:createdTimestamp()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

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

Webhook:delete()

#

Permanently delete this resource through REST.

Signature

Webhook:delete()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:delete()

Webhook:deleteMessage()

#

Permanently delete Message through REST.

Signature

Webhook:deleteMessage(messageId)

Parameters

NameTypeRequiredBehavior
messageId string required Snowflake id string.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:deleteMessage("123")

Webhook:edit()

#

Apply a REST update to this resource.

Signature

Webhook:edit(options)

Parameters

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

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:edit({})

Webhook:editMessage()

#

Apply a REST update to Message and refresh the local object when the request succeeds.

Signature

Webhook:editMessage(messageId, contentOrOptions)

Parameters

NameTypeRequiredBehavior
messageId string required Snowflake id string.
contentOrOptions table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:editMessage("123", "Hello")

Webhook:fetchMessage()

#

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

Signature

Webhook:fetchMessage(messageId, callback)

Parameters

NameTypeRequiredBehavior
messageId string required Snowflake id string.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Webhook — the same instance, for chaining.

Example

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

Webhook:isApplicationCreated()

#

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

Signature

Webhook:isApplicationCreated()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:isApplicationCreated()

Webhook:isChannelFollower()

#

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

Signature

Webhook:isChannelFollower()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:isChannelFollower()

Webhook:isIncoming()

#

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

Signature

Webhook:isIncoming()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:isIncoming()

Webhook:isUserCreated()

#

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

Signature

Webhook:isUserCreated()

Parameters

No parameters.

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:isUserCreated()

Webhook:path()

#

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

Signature

Webhook:path(suffix)

Parameters

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

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:path(suffix)

Webhook:send()

#

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

Signature

Webhook:send(contentOrOptions)

Parameters

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

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:send("Hello")

Webhook:sendSlackMessage()

#

Send SlackMessage using this Webhook.

Signature

Webhook:sendSlackMessage(body)

Parameters

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

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
object:sendSlackMessage(body)

Webhook.wrapMany()

# static

Performs wrap many on this Webhook. Call it from bot code when you need that operation on the current object.

Signature

Webhook.wrapMany(client, data)

Parameters

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

Returns

Webhook — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Webhook
Webhook.wrapMany(client, data)

Examples

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

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc