Class DiscordRest

Discord REST API interface

Class DiscordRest

DiscordRest.channelTypes Discord channel types
DiscordRest:new (botToken) Create a new Discord REST API interface

Channel

DiscordRest:addThreadMember (channelId, userId, botToken) Adds another member to a thread.
DiscordRest:bulkDeleteMessages (channelId, messages, botToken) Delete multiple messages in a single request.
DiscordRest:createChannelInvite (channelId, invite, botToken) Create a new invite for a channel.
DiscordRest:createMessage (channelId, message, botToken) Post a message.
DiscordRest:createReaction (channelId, messageId, emoji, botToken) Create a reaction for a message.
DiscordRest:crosspostMessage (channelId, messageId, botToken) Crosspost a message in a News Channel to following channels.
DiscordRest:deleteAllReactions (channelId, messageId, botToken) Deletes all reactions on a message.
DiscordRest:deleteAllReactionsForEmoji (channelId, messageId, emoji, botToken) Deletes all the reactions for a given emoji on a message.
DiscordRest:deleteChannel (channelId, botToken) Delete a channel.
DiscordRest:deleteChannelPermission (channelId, overwriteId, botToken) Delete a channel permission overwrite for a user or role in a channel.
DiscordRest:deleteMessage (channelId, messageId, botToken) Delete a message from a channel.
DiscordRest:deleteOwnReaction (channelId, messageId, emoji, botToken) Remove own reaction from a message.
DiscordRest:deleteUserReaction (channelId, messageId, emoji, userId, botToken) Remove a user's reaction from a message.
DiscordRest:editChannelPermissions (channelId, overwriteId, permissions, botToken) Edit the channel permission overwrites for a user or role in a channel.
DiscordRest:editMessage (channelId, messageId, message, botToken) Edit a previously sent message.
DiscordRest:followNewsChannel (channelId, targetChannelId, botToken) Follow a News Channel to send messages to a target channel.
DiscordRest:getChannel (channelId, botToken) Get channel information.
DiscordRest:getChannelInvites (channelId, botToken) Get a list of invites for a channel.
DiscordRest:getChannelMessage (channelId, messageId, botToken) Get a specific message from a channel.
DiscordRest:getChannelMessages (channelId, options, botToken) Get a list of messages from a channels
DiscordRest:getPinnedMessages (channelId, botToken) Returns all pinned messages in the channel.
DiscordRest:getReactions (channelId, messageId, emoji, options, botToken) Get a list of users that reacted to a message with a specific emoji.
DiscordRest:groupDmAddRecipient (channelId, userId, params, botToken) Adds a recipient to a Group DM using their access token.
DiscordRest:groupDmRemoveRecipient (channelId, userId, botToken) Removes a recipient from a Group DM.
DiscordRest:joinThread (channelId, botToken) Adds the current user to a thread.
DiscordRest:leaveThread (channelId, botToken) Removes the current user from a thread.
DiscordRest:listActiveThreads (channelId, botToken) Returns all active threads in the channel, including public and private threads.
DiscordRest:listJoinedPrivateArchivedThreads (channelId, options, botToken) Returns archived threads in the channel that are private, and the user has joined.
DiscordRest:listPrivateArchivedThreads (channelId, options, botToken) Returns archived threads in the channel that are private.
DiscordRest:listPublicArchivedThreads (channelId, options, botToken) Returns archived threads in the channel that are public.
DiscordRest:listThreadMembers (channelId, botToken) Get a list of members of a thread.
DiscordRest:modifyChannel (channelId, channel, botToken) Update a channel's settings.
DiscordRest:pinMessage (channelId, messageId, botToken) Pin a message in a channel.
DiscordRest:removeThreadMember (channelId, userId, botToken) Removes another member from a thread.
DiscordRest:startThreadWithMessage (channelId, messageId, params, botToken) Creates a new thread from an existing message.
DiscordRest:startThreadWithoutMessage (channelId, params, botToken) Creates a new thread that is not connected to an existing message.
DiscordRest:triggerTypingIndicator (channelId, botToken) Post a typing indicator for the specified channel.
DiscordRest:unpinMessage (channelId, messageId, botToken) Unpin a message in a channel.

Emoji

DiscordRest:createGuildEmoji (guildId, params, botToken) Create a new emoji for the guild.
DiscordRest:deleteGuildEmoji (guildId, emojiId, botToken) Delete the given emoji.
DiscordRest:getGuildEmoji (guildId, emojiId, botToken) Get information on a guild emoji.
DiscordRest:listGuildEmojis (guildId, botToken) Return a list of emoji for the given guild.
DiscordRest:modifyGuildEmoji (guildId, emojiId, params, botToken) Modify the given emoji.

Guild

DiscordRest:addGuildMember (guildId, userId, params, botToken) Adds a user to the guild.
DiscordRest:addGuildMemberRole (guildId, userId, roleId, botToken) Adds a role to a guild member.
DiscordRest:beginGuildPrune (guildId, params, botToken) Begin a prune operation.
DiscordRest:createGuild (params, botToken) Create a new guild.
DiscordRest:createGuildBan (guildId, userId, params, botToken) Create a guild ban, and optionally delete previous messages sent by the banned user.
DiscordRest:createGuildChannel (guildId, params, botToken) Create a new guild channel.
DiscordRest:createGuildRole (guildId, params, botToken) Create a new role for the guild.
DiscordRest:deleteGuild (guildId, botToken) Delete a guild permanently.
DiscordRest:deleteGuildIntegration (guildId, integrationId, botToken) Delete an integration for a guild.
DiscordRest:deleteGuildRole (guildId, roleId, botToken) Delete a guild role.
DiscordRest:getGuild (guildId, withCounts, botToken) Get info for a given guild.
DiscordRest:getGuildBan (guildId, userId, botToken) Return info on a ban for a specific user in a guild.
DiscordRest:getGuildBans (guildId, botToken) Get a list of bans for a guild.
DiscordRest:getGuildChannels (guildId, botToken) Get a list of guild channels.
DiscordRest:getGuildIntegrations (guildId, botToken) Get a list of integrations for a guild.
DiscordRest:getGuildInvites (guildId, botToken) Get a list of invites for a guild.
DiscordRest:getGuildMember (guildId, userId, botToken) Get guild membership info for a user.
DiscordRest:getGuildPreview (guildId, botToken) Get preview information for a guild.
DiscordRest:getGuildPruneCount (guildId, options, botToken) Get the number of members that would be removed in a prune operation.
DiscordRest:getGuildRoles (guildId, botToken) Get a list of roles for a guild.
DiscordRest:getGuildVanityUrl (guildId, botToken) Get the vanity URL for a guild.
DiscordRest:getGuildVoiceRegions (guildId, botToken) Get a list of voice regions for a guild.
DiscordRest:getGuildWelcomeScreen (guildId, botToken) Get the welcome screen for a guild.
DiscordRest:getGuildWidget (guildId) Get the widget for a guild.
DiscordRest:getGuildWidgetImage (guildId, style) Get the widget image for a guild.
DiscordRest:getGuildWidgetSettings (guildId, botToken) Get guild widget settings.
DiscordRest:listActiveGuildThreads (guildId, botToken) Returns all active threads in the guild, including public and private threads.
DiscordRest:listGuildMembers (guildId, options, botToken) Get a list of members in a guild.
DiscordRest:modifyCurrentUserNick (guildId, nick, botToken) Modifies the nickname of the current user in a guild.
DiscordRest:modifyCurrentUserVoiceState (guildId, params, botToken) Updates the current user's voice state.
DiscordRest:modifyGuild (guildId, settings, botToken) Modify a guild's settings.
DiscordRest:modifyGuildChannelPositions (guildId, channelPositions, botToken) Modify the positions of a set of channels.
DiscordRest:modifyGuildMember (guildId, userId, params, botToken) Modify guild membership attributes of a user.
DiscordRest:modifyGuildRole (guildId, roleId, params, botToken) Modify a guild role.
DiscordRest:modifyGuildRolePositions (guildId, params, botToken) Modify the positions of a set of roles for a guild.
DiscordRest:modifyGuildWelcomeScreen (guildId, params, botToken) Modify a guild's welcome screen.
DiscordRest:modifyGuildWidget (guildId, widget, botToken) Modify a guild widget.
DiscordRest:modifyUserVoiceState (guildId, userId, params, botToken) Updates another user's voice state.
DiscordRest:removeGuildBan (guildId, userId, botToken) Remove a guild ban for a user.
DiscordRest:removeGuildMember (guildId, userId, botToken) Remove a member from a guild.
DiscordRest:removeGuildMemberRole (guildId, userId, roleId, botToken) Removes a role from a guild member.
DiscordRest:searchGuildMembers (guildId, options, botToken) Get a list of guild members whose username or nickname starts with a provided string.

Invite

DiscordRest:deleteInvite (inviteCode, botToken) Delete an invite.
DiscordRest:getInvite (inviteCode, options, botToken) Return info for an invite.

User

DiscordRest:createDm (recipientId, botToken) Create a new DM channel with a user.
DiscordRest:getCurrentUser (botToken) Get the current user's information.
DiscordRest:getCurrentUserGuilds (options, botToken) Get the current user's guilds.
DiscordRest:getUser (userId, botToken) Get user information.
DiscordRest:getUserConnections (botToken) Get a list of the current user's connections.
DiscordRest:leaveGuild (guildId, botToken) Leave a guild.
DiscordRest:modifyCurrentUser (params, botToken) Modify the requester's user account settings.

Webhook

DiscordRest:deleteWebhook (webhookId, botToken) Delete a webhook.
DiscordRest:deleteWebhookMessage (webhookId, webhookToken, messageId) Deletes a message that was created by the webhook.
DiscordRest:deleteWebhookWithToken (webhookId, webhookToken) Delete a webhook, using its token for authorization instead of a bot token.
DiscordRest:deleteWebhookWithUrl (url) Delete a webhook, using its full URL for authorization instead of a bot token.
DiscordRest:editWebhookMessage (webhookId, webhookToken, messageId, params) Edits a previously-sent webhook message from the same token.
DiscordRest:executeGitHubCompatibleWebhook (webhookId, webhookToken, data, options) Execute a GitHub webhook.
DiscordRest:executeGitHubCompatibleWebhookUrl (url, data, options) Execute a GitHub webhook, using the full URL.
DiscordRest:executeSlackCompatibleWebhook (webhookId, webhookToken, data, options) Execute a Slack webhook.
DiscordRest:executeSlackCompatibleWebhookUrl (url, data, options) Execute a Slack webhook, using the full URL.
DiscordRest:executeWebhook (webhookId, webhookToken, data, options) Execute a webhook.
DiscordRest:executeWebhookUrl (url, data, options) Execute a webhook, using the full URL.
DiscordRest:getChannelWebhooks (channelId, botToken) Get a list of webhooks for a channel.
DiscordRest:getGuildWebhooks (guildId, botToken) Get a list of webhooks for a guild.
DiscordRest:getWebhook (webhookId, botToken) Get information for a webhook.
DiscordRest:getWebhookMessage (webhookId, webhookToken, messageId) Returns a previously-sent webhook message from the same token.
DiscordRest:getWebhookWithToken (webhookId, webhookToken) Get information for a webhook, using its token for authorization instead of a bot token.
DiscordRest:getWebhookWithUrl (url) Get information for a webhook, using its full URL for authorization instead of a bot token.
DiscordRest:modifyWebhook (webhookId, params, botToken) Modify a webhook.
DiscordRest:modifyWebhookWithToken (webhookId, webhookToken, params) Modify a webhook, using its token for authorization instead of a bot token.
DiscordRest:modifyWebhookWithUrl (url, params) Modify a webhook, using its full URL for authorization instead of a bot token.

Player

DiscordRest:getUserId (player) Get the Discord user ID of a player.
DiscordRest:addGuildMemberRoleToPlayer (guildId, player, roleId, botToken) Adds a guild role to a player.
DiscordRest:addPlayerToGuild (guildId, player, params, botToken) Adds a player to a guild.
DiscordRest:addPlayerToThread (channelId, player, botToken) Adds a player to a thread.
DiscordRest:createGuildBanForPlayer (guildId, player, params, botToken) Create a guild ban for a player.
DiscordRest:deletePlayerReaction (channelId, messageId, emoji, player, botToken) Remove a player's reaction from a message.
DiscordRest:getGuildBanForPlayer (guildId, player, botToken) Return info on a ban for a player in a guild.
DiscordRest:getGuildMemberForPlayer (guildId, player, botToken) Get guild membership info for a player.
DiscordRest:getUserForPlayer (player, botToken) Get user information for a player.
DiscordRest:groupDmAddPlayer (channelId, player, params, botToken) Adds a player to a Group DM.
DiscordRest:groupDmRemovePlayer (channelId, player, botToken) Removes a player from a Group DM.
DiscordRest:modifyGuildMemberForPlayer (guildId, player, params, botToken) Modify guild membership attributes of a player.
DiscordRest:modifyPlayerVoiceState (guildId, player, params, botToken) Updates a player's voice state.
DiscordRest:removeGuildBanForPlayer (guildId, player, botToken) Remove a guild ban for a player.
DiscordRest:removeGuildMemberRoleFromPlayer (guildId, player, roleId, botToken) Removes a guild role from a player.
DiscordRest:removePlayerFromGuild (guildId, player, botToken) Remove a player from a guild.
DiscordRest:removePlayerFromThread (channelId, player, botToken) Remove a player from a thread.


Class DiscordRest

Discord REST API interface
DiscordRest.channelTypes
Discord channel types

Fields:

  • GUILD_TEXT a text channel within a server
  • DM a direct message between users
  • GUILD_VOICE a voice channel within a server
  • GROUP_DM a direct message between multiple users
  • GUILD_CATEGORY an organizational category that contains up to 50 channels
  • GUILD_NEWS a channel that users can follow and crosspost into their own server
  • GUILD_STORE a channel in which game developers can sell their game on Discord
  • GUILD_NEWS_THREAD a temporary sub-channel within a GUILD_NEWS channel
  • GUILD_PUBLIC_THREAD a temporary sub-channel within a GUILD_TEXT channel
  • GUILD_PRIVATE_THREAD a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission
  • GUILD_STAGE_VOICE a voice channel for hosting events with an audience

See also:

DiscordRest:new (botToken)
Create a new Discord REST API interface

Parameters:

  • botToken Optional bot token to use for authorization

Returns:

    A new Discord REST API interface object

Usage:

    local discord = DiscordRest:new("[bot token]")

Channel

DiscordRest:addThreadMember (channelId, userId, botToken)
Adds another member to a thread.

Parameters:

  • channelId The ID of the thread channel.
  • userId The ID of the user to add to the thread.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:addThreadMember("[channel ID]", "[user ID]")
DiscordRest:bulkDeleteMessages (channelId, messages, botToken)
Delete multiple messages in a single request.

Parameters:

  • channelId The ID of the channel containing the messages.
  • messages A list of message IDs to delete (2-100).
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:bulkDeleteMessages("[channel ID]", {"[message ID 1]", "[message ID 2]", ...})
DiscordRest:createChannelInvite (channelId, invite, botToken)
Create a new invite for a channel.

Parameters:

  • channelId The ID of the channel to create an invite for.
  • invite The invite settings.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that resolves with the newly created invite.

See also:

Usage:

    discord:createChannelInvite("[channel ID]", {max_age = 3600, max_uses = 1})
DiscordRest:createMessage (channelId, message, botToken)
Post a message.

Parameters:

  • channelId The ID of the channel to post in.
  • message The message parameters.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved when the message is posted.

See also:

Usage:

    discord:createMessage("[channel ID]", {content = "Hello, world!"})
DiscordRest:createReaction (channelId, messageId, emoji, botToken)
Create a reaction for a message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to add a reaction to.
  • emoji The emoji to react with.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved when the reaction is added to the message.

See also:

Usage:

    discord:createReaction("[channel ID]", "[message ID]", "💗")
DiscordRest:crosspostMessage (channelId, messageId, botToken)
Crosspost a message in a News Channel to following channels.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to crosspost.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the crossposted message.

See also:

Usage:

    discord:crosspostMessage("[channel ID]", "[message ID]")
DiscordRest:deleteAllReactions (channelId, messageId, botToken)
Deletes all reactions on a message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message whose reactions will be deleted.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteAllReactions("[channel ID]", "[message ID]")
DiscordRest:deleteAllReactionsForEmoji (channelId, messageId, emoji, botToken)
Deletes all the reactions for a given emoji on a message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to delete reactions from.
  • emoji The emoji of the reaction to delete.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteAllReactionsForEmoji("[channel ID]", "[message ID]", "💗")
DiscordRest:deleteChannel (channelId, botToken)
Delete a channel.

Parameters:

  • channelId The ID of the channel.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteChannel("[channel ID]")
DiscordRest:deleteChannelPermission (channelId, overwriteId, botToken)
Delete a channel permission overwrite for a user or role in a channel.

Parameters:

  • channelId The ID of the channel.
  • overwriteId The ID of the user or role to remove permissions for.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteChannelPermission("[channel ID]", "[overwrite ID]")
DiscordRest:deleteMessage (channelId, messageId, botToken)
Delete a message from a channel.

Parameters:

  • channelId The ID of the channel.
  • messageId The ID of the message.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteMessage("[channel ID]", "[message ID]")
DiscordRest:deleteOwnReaction (channelId, messageId, emoji, botToken)
Remove own reaction from a message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to remove the reaction from.
  • emoji The emoji of the reaction to remove.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteOwnReaction("[channel ID]", "[message ID]", "💗")
DiscordRest:deleteUserReaction (channelId, messageId, emoji, userId, botToken)
Remove a user's reaction from a message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The message to remove the reaction from.
  • emoji The emoji of the reaction to remove.
  • userId The ID of the user whose reaction will be removed.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteUserReaction("[channel ID]", "[message ID]", "💗", "[user ID]")
DiscordRest:editChannelPermissions (channelId, overwriteId, permissions, botToken)
Edit the channel permission overwrites for a user or role in a channel.

Parameters:

  • channelId The ID of the channel to edit the permissions of.
  • overwriteId The ID of the user or role to edit permissions for.
  • permissions The permissions to set.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:editChannelPermissions("[channel ID]", "[overwrite ID]", {allow = 6, deny = 8, type = 0})
DiscordRest:editMessage (channelId, messageId, message, botToken)
Edit a previously sent message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to edit.
  • message The edited message.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise, which resolves with the edited message when the request is completed.

See also:

Usage:

    discord:editMessage("[channel ID]", "[message ID]", {content = "I edited this message!"})
DiscordRest:followNewsChannel (channelId, targetChannelId, botToken)
Follow a News Channel to send messages to a target channel.

Parameters:

  • channelId The ID of the news channel.
  • targetChannelId The ID of the target channel.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that resolves with a followed channel object.

See also:

Usage:

    discord:followNewsChannel("[channel ID]", "[target channel ID]")
DiscordRest:getChannel (channelId, botToken)
Get channel information.

Parameters:

  • channelId The ID of the channel.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:getChannel("[channel ID]"):next(function(channel) ... end)
DiscordRest:getChannelInvites (channelId, botToken)
Get a list of invites for a channel.

Parameters:

  • channelId The ID of the channel to get invites for.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that resolves with the list of invites.

See also:

Usage:

    discord:getChannelInvites("[channel ID]"):next(function(invites) ... end)
DiscordRest:getChannelMessage (channelId, messageId, botToken)
Get a specific message from a channel.

Parameters:

  • channelId The ID of the channel.
  • messageId The ID of the message.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:getChannelMessage("[channel ID]", "[messageId]")
DiscordRest:getChannelMessages (channelId, options, botToken)
Get a list of messages from a channels

Parameters:

  • channelId The ID of the channel.
  • options Options to tailor the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:getChannelMessage("[channel ID]", {limit = 1}):next(function(messages) ... end)
DiscordRest:getPinnedMessages (channelId, botToken)
Returns all pinned messages in the channel.

Parameters:

  • channelId The ID of the channel to get pinned messages from.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which resolves with a list of pinned messages.

See also:

Usage:

    discord:getPinnedMessages("[channel ID]")
DiscordRest:getReactions (channelId, messageId, emoji, options, botToken)
Get a list of users that reacted to a message with a specific emoji.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to get reactions from.
  • emoji The emoji of the reaction.
  • options Options to tailor the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:getReactions("[channel ID]", "[message ID]", "💗"):next(function(users) ... end)
DiscordRest:groupDmAddRecipient (channelId, userId, params, botToken)
Adds a recipient to a Group DM using their access token.

Parameters:

  • channelId The ID of the group DM channel.
  • userId The ID of the user to add.
  • params Parameters for adding the user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:groupDmAddRecipient("[channel ID]", "[user ID]", {access_token = "..."})
DiscordRest:groupDmRemoveRecipient (channelId, userId, botToken)
Removes a recipient from a Group DM.

Parameters:

  • channelId The ID of the group DM channel.
  • userId The ID of the user to remove.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:groupDmRemoveRecipient("[channel ID]", "[user ID]")
DiscordRest:joinThread (channelId, botToken)
Adds the current user to a thread.

Parameters:

  • channelId The ID of the thread channel to join.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:joinThread("[channel ID]")
DiscordRest:leaveThread (channelId, botToken)
Removes the current user from a thread.

Parameters:

  • channelId The ID of the thread channel to leave.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:leaveThread("[channel ID]")
DiscordRest:listActiveThreads (channelId, botToken)
Returns all active threads in the channel, including public and private threads.

Parameters:

  • channelId The ID of the channel to get a list of active threads for.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a table of information on active threads.

See also:

Usage:

    discord:listActiveThreads("[channel ID]"):next(function(data) ... end)
DiscordRest:listJoinedPrivateArchivedThreads (channelId, options, botToken)
Returns archived threads in the channel that are private, and the user has joined.

Parameters:

  • channelId The ID of the channel to get a list of private archived threads from.
  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a table of information on private archived threads.

See also:

Usage:

    discord:listJoinedPrivateArchivedThreads("[channel ID]", {limit = 5}):next(function(data) ... end)
DiscordRest:listPrivateArchivedThreads (channelId, options, botToken)
Returns archived threads in the channel that are private.

Parameters:

  • channelId The ID of the channel to get a list of private archived threads from.
  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a table of information on private archived threads.

See also:

Usage:

    discord:listPrivateArchivedThreads("[channel ID]", {limit = 5}):next(function(data) ... end)
DiscordRest:listPublicArchivedThreads (channelId, options, botToken)
Returns archived threads in the channel that are public.

Parameters:

  • channelId The ID of the channel to get a list of public archived threads from.
  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a table of information on public archived threads.

See also:

Usage:

    discord:listPublicArchivedThreads("[channel ID]", {limit = 5}):next(function(data) ... end)
DiscordRest:listThreadMembers (channelId, botToken)
Get a list of members of a thread.

Parameters:

  • channelId The ID of the thread channel.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of members of the thread.

See also:

Usage:

    discord:listThreadMembers("[channel ID]"):next(function(members) ... end)
DiscordRest:modifyChannel (channelId, channel, botToken)
Update a channel's settings.

Parameters:

  • channelId The ID of the channel.
  • channel The new channel settings.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:modifyChannel("[channel ID]", {name = "new-name"})
DiscordRest:pinMessage (channelId, messageId, botToken)
Pin a message in a channel.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to pin.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:pinMessage("[channel ID]", "[message ID]")
DiscordRest:removeThreadMember (channelId, userId, botToken)
Removes another member from a thread.

Parameters:

  • channelId The ID of the thread channel.
  • userId The ID of the user to remove from the thread.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removeThreadMember("[channel ID]", "[user ID]")
DiscordRest:startThreadWithMessage (channelId, messageId, params, botToken)
Creates a new thread from an existing message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to start the thread from.
  • params Parameters for the thread.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that resolves with the new thread channel.

See also:

Usage:

    discord:startThreadWithMessage("[channel ID]", "[message ID]", {name = "New thread"}):next(function(channel) ... end)
DiscordRest:startThreadWithoutMessage (channelId, params, botToken)
Creates a new thread that is not connected to an existing message.

Parameters:

  • channelId The ID of the channel to create the thread in.
  • params Parameters for the thread.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that resolves with the new thread channel.

See also:

Usage:

    discord:startThreadWithoutMessage("[channel ID]", {name = "New thread"}):next(function(channel) ... end)
DiscordRest:triggerTypingIndicator (channelId, botToken)
Post a typing indicator for the specified channel.

Parameters:

  • channelId The ID of the channel to show the typing indicator in.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:triggerTypingIndicator("[channel ID]")
DiscordRest:unpinMessage (channelId, messageId, botToken)
Unpin a message in a channel.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The ID of the message to unpin.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:unpinMessage("[channel ID]", "[message ID]")

Emoji

DiscordRest:createGuildEmoji (guildId, params, botToken)
Create a new emoji for the guild.

Parameters:

  • guildId The ID of the guild to create the emoji for.
  • params Parameters for the new emoji.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise whih is resolved with the new emoji.

See also:

Usage:

    discord:createGuildEmoji("[guild ID]", {name = "emojiname", image = "data:image/jpeg;base64,..."})
DiscordRest:deleteGuildEmoji (guildId, emojiId, botToken)
Delete the given emoji.

Parameters:

  • guildId The ID of the guild to delete the emoji from.
  • emojiId The ID of the emoji to delete.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteGuildEmoji("[guild ID]", "[emoji ID]")
DiscordRest:getGuildEmoji (guildId, emojiId, botToken)
Get information on a guild emoji.

Parameters:

  • guildId The ID of the guild where the emoji is from.
  • emojiId The ID of the emoji to get information about.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the information about the emoji.

See also:

Usage:

    discord:getGuildEmoji("[guild ID]", "[emoji ID]"):next(function(emoji) ... end)
DiscordRest:listGuildEmojis (guildId, botToken)
Return a list of emoji for the given guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the list of emoji.

See also:

Usage:

    discord:listGuildEmojis("[guild ID]"):next(function(emojis) ... end)
DiscordRest:modifyGuildEmoji (guildId, emojiId, params, botToken)
Modify the given emoji.

Parameters:

  • guildId The ID of the guild where the emoji is from.
  • emojiId The ID of the emoji to modify.
  • params Modified parameters for the emoji.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the updated emoji.

See also:

Usage:

    discord:modifyGuildEmoji("[guild ID]", "[emoji ID]", {name = "newemojiname"})

Guild

DiscordRest:addGuildMember (guildId, userId, params, botToken)
Adds a user to the guild.

Parameters:

  • guildId The ID of the guild to add the user to.
  • userId The ID of the user to add to the guild.
  • params Parameters for adding the user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:addGuildMember("[guild ID]", "[user ID]", {access_token = "..."})
DiscordRest:addGuildMemberRole (guildId, userId, roleId, botToken)
Adds a role to a guild member.

Parameters:

  • guildId The ID of the guild.
  • userId The ID of the user to add the role to.
  • roleId The ID of the role to add to the member.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:addGuildMemberRole("[guild ID]", "[user ID]", "[role ID]")
DiscordRest:beginGuildPrune (guildId, params, botToken)
Begin a prune operation.

Parameters:

  • guildId The ID of the guild to prune.
  • params Parameters for pruning.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the number of members that were pruned.

See also:

Usage:

    discord:beginGuildPrune("[guild ID]"):next(function(pruned) ... end)
DiscordRest:createGuild (params, botToken)
Create a new guild.

Parameters:

  • params Parameters for the new guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the new guild.

See also:

Usage:

    discord:createGuild({name = "My Guild"})
DiscordRest:createGuildBan (guildId, userId, params, botToken)
Create a guild ban, and optionally delete previous messages sent by the banned user.

Parameters:

  • guildId The ID of the guild to create the ban for.
  • userId The ID of the user to ban.
  • params Parameters for the ban.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:createGuildBan("[guild ID]", "[user ID]", {reason = "Not following the rules"})
DiscordRest:createGuildChannel (guildId, params, botToken)
Create a new guild channel.

Parameters:

  • guildId The ID of the guild to create the channel in.
  • params Parameters for the new channel.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the new channel.

See also:

Usage:

    discord:createGuildChannel(["guild ID"], {name = "new-channel"}):next(function(channel) ... end)
DiscordRest:createGuildRole (guildId, params, botToken)
Create a new role for the guild.

Parameters:

  • guildId The ID of the guild.
  • params Parameters for the new role.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the new role.

See also:

Usage:

    discord:createGuildRole("[guild ID]", {name = "Moderator", ...}):next(function(role) ... end)
DiscordRest:deleteGuild (guildId, botToken)
Delete a guild permanently.

Parameters:

  • guildId The ID of the guild to delete.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteGuild("[guild ID]")
DiscordRest:deleteGuildIntegration (guildId, integrationId, botToken)
Delete an integration for a guild.

Parameters:

  • guildId The ID of the guild
  • integrationId The ID of the integration to delete.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteGuildIntegration("[guild ID]", "[integration ID]")
DiscordRest:deleteGuildRole (guildId, roleId, botToken)
Delete a guild role.

Parameters:

  • guildId The ID of the guild.
  • roleId The ID of the role that will be deleted.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteGuildRole("[guild ID]", "[role ID]")
DiscordRest:getGuild (guildId, withCounts, botToken)
Get info for a given guild.

Parameters:

  • guildId The ID of the guild.
  • withCounts Whether to include approximate member and presence counts in the returned info.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the guild info.

See also:

Usage:

    discord:getGuild("[guild ID]"):next(function(guild) ... end)
DiscordRest:getGuildBan (guildId, userId, botToken)
Return info on a ban for a specific user in a guild.

Parameters:

  • guildId The ID of the guild.
  • userId The ID of the banned user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the ban info.

See also:

Usage:

    discord:getGuildBan("[guild ID]", "[user ID]"):next(function(ban) ... end)
DiscordRest:getGuildBans (guildId, botToken)
Get a list of bans for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of bans.

See also:

Usage:

    discord:getGuildBans("[guild ID]"):next(function(bans) ... end)
DiscordRest:getGuildChannels (guildId, botToken)
Get a list of guild channels.

Parameters:

  • guildId The ID of the guild to get a list of channels for.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the list of channels.

See also:

Usage:

    discord:getGuildChannels("[guild ID]"):next(function(channels) ... end)
DiscordRest:getGuildIntegrations (guildId, botToken)
Get a list of integrations for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the list of integrations.

See also:

Usage:

    discord:getGuildIntegrations("[guild ID]"):next(function(integrations) ... end)
DiscordRest:getGuildInvites (guildId, botToken)
Get a list of invites for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the list of invites.

See also:

Usage:

    discord:getGuildInvites("[guild ID]"):next(function(invites) ... end)
DiscordRest:getGuildMember (guildId, userId, botToken)
Get guild membership info for a user.

Parameters:

  • guildId The ID of the guild.
  • userId The ID of the user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that resolves with the info of the member if they are in the guild.

See also:

Usage:

    discord:getGuildMember("[guild ID]", "[user ID]"):next(function(member) ... end)
DiscordRest:getGuildPreview (guildId, botToken)
Get preview information for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the preview info for the guild.

See also:

Usage:

    discord:getGuildPreview("[guild ID]"):next(function(preview) ... end)
DiscordRest:getGuildPruneCount (guildId, options, botToken)
Get the number of members that would be removed in a prune operation.

Parameters:

  • guildId The ID of the guild that would be pruned.
  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the number of users that would be pruned.

See also:

Usage:

    discord:getGuildPruneCount("[guild ID]"):next(function(pruned) ... end)
DiscordRest:getGuildRoles (guildId, botToken)
Get a list of roles for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the list of roles.

See also:

Usage:

    discord:getGuildRoles("[guild ID]"):next(function(roles) ... end)
DiscordRest:getGuildVanityUrl (guildId, botToken)
Get the vanity URL for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the vanity URL.

See also:

Usage:

    discord:getGuildVanityUrl("[guild ID]"):next(function(vanityUrl) ... end)
DiscordRest:getGuildVoiceRegions (guildId, botToken)
Get a list of voice regions for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the list of voice regions.

See also:

Usage:

    discord:getGuildVoiceRegions("[guild ID]"):next(function(regions) ... end)
DiscordRest:getGuildWelcomeScreen (guildId, botToken)
Get the welcome screen for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the welcome screen.

See also:

Usage:

    discord:getGuildWelcomeScreen("[guild ID]"):next(function(welcomeScreen) ... end)
DiscordRest:getGuildWidget (guildId)
Get the widget for a guild.

Parameters:

  • guildId The ID of the guild.

Returns:

    A new promise which is resolved with the widget.

See also:

Usage:

    discord:getGuildWidget("[guild ID]"):next(function(widget) ... end)
DiscordRest:getGuildWidgetImage (guildId, style)
Get the widget image for a guild.

Parameters:

  • guildId The ID of the guild.
  • style Style of the widget image returned.

Returns:

    A new promise which is resolved with the widget image.

See also:

Usage:

    discord:getGuildWidgetImage("[guild ID]", "shield"):next(function(image) ... end)
DiscordRest:getGuildWidgetSettings (guildId, botToken)
Get guild widget settings.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the widget settings.

See also:

Usage:

    discord:getGuildWidgetSettings("[guild ID]"):next(function(settings) ... end)
DiscordRest:listActiveGuildThreads (guildId, botToken)
Returns all active threads in the guild, including public and private threads.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the lists of threads and thread members.

See also:

Usage:

    discord:listActiveGuildThreads("[guild ID]"):next(function(data) ... end)
DiscordRest:listGuildMembers (guildId, options, botToken)
Get a list of members in a guild.

Parameters:

  • guildId The ID of the guild to get a list of members for.
  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of guild members.

See also:

Usage:

    discord:listGuildMembers("[guild ID]", {limit = 5}):next(function(members) ... end)
DiscordRest:modifyCurrentUserNick (guildId, nick, botToken)
Modifies the nickname of the current user in a guild.

Parameters:

  • guildId The ID of the guild.
  • nick The value to set the user's nickname to.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:modifyCurrentUserNick("[guild ID]", "New nickname")
DiscordRest:modifyCurrentUserVoiceState (guildId, params, botToken)
Updates the current user's voice state.

Parameters:

  • guildId The ID of the guild to modify voice state in.
  • params Parameters for modifying the voice state.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:modifyCurrentUserVoiceState("[guild ID]", {...})
DiscordRest:modifyGuild (guildId, settings, botToken)
Modify a guild's settings.

Parameters:

  • guildId The ID of the guild to modify.
  • settings The modified settings for the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the updated guild.

See also:

Usage:

    discord:modifyGuild("[guild ID]", {name = "New guild name"})
DiscordRest:modifyGuildChannelPositions (guildId, channelPositions, botToken)
Modify the positions of a set of channels.

Parameters:

  • guildId The ID of the guild containing the channels.
  • channelPositions A set of channel position parameters.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:modifyGuildChannelPositions("[guild ID]", {{id = "[channel 1 ID]", position = 2}, {"[channel 2 ID]", position = 1}})
DiscordRest:modifyGuildMember (guildId, userId, params, botToken)
Modify guild membership attributes of a user.

Parameters:

  • guildId The ID of the guild.
  • userId The ID of the member to modify.
  • params The parameters to modify.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the modified guild member.

See also:

Usage:

    discord:modifyGuildMember("[guild ID]", "[user ID]", {nick = "New nickname"})
DiscordRest:modifyGuildRole (guildId, roleId, params, botToken)
Modify a guild role.

Parameters:

  • guildId The ID of the guild.
  • roleId The ID of the role to modify.
  • params Parameters for modifications to the role.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the modified role.

See also:

Usage:

    discord:modifyGuildRole("[guild ID]", "[role ID]", {name = "New role name"})
DiscordRest:modifyGuildRolePositions (guildId, params, botToken)
Modify the positions of a set of roles for a guild.

Parameters:

  • guildId The ID of the guild.
  • params A list of roles and their new positions.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of all guild roles.

See also:

Usage:

    discord:modifyGuildRolePositions("[guild ID]", {{"[role ID 1]", 2}, {"[role ID 2]", 3}, ...})
DiscordRest:modifyGuildWelcomeScreen (guildId, params, botToken)
Modify a guild's welcome screen.

Parameters:

  • guildId The ID of the guild.
  • params Parameters for modifying the welcome screen.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the updated welcome screen.

See also:

Usage:

    discord:modifyGuildWelcomeScreen("[guild ID]", {enabled = true}):next(function(welcomeScreen) ... end)
DiscordRest:modifyGuildWidget (guildId, widget, botToken)
Modify a guild widget.

Parameters:

  • guildId The ID of the guild.
  • widget The modified widget attributes.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the updated widget.

See also:

Usage:

    discord:modifyGuildWidget("[guild ID]", {...}):next(function(widget) ... end)
DiscordRest:modifyUserVoiceState (guildId, userId, params, botToken)
Updates another user's voice state.

Parameters:

  • guildId The ID of the guild.
  • userId The ID of the user.
  • params Parameters for modifying the voice state.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:modifyUserVoiceState("[guild ID]", "[user ID]", {...})
DiscordRest:removeGuildBan (guildId, userId, botToken)
Remove a guild ban for a user.

Parameters:

  • guildId The ID of the guild to remove the ban for the user from.
  • userId The ID of the user to unban.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removeGuildBan("[guild ID]", "[user ID]")
DiscordRest:removeGuildMember (guildId, userId, botToken)
Remove a member from a guild.

Parameters:

  • guildId The ID of the guild to remove the member from.
  • userId The ID of the member to remove from the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removeGuildMember("[guild ID]", "[user ID]")
DiscordRest:removeGuildMemberRole (guildId, userId, roleId, botToken)
Removes a role from a guild member.

Parameters:

  • guildId The ID of the guild.
  • userId The ID of the user to remove the role from.
  • roleId The ID of the role to remove from the member.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removeGuildMemberRole("[guild ID]", "[user ID]", "[role ID]")
DiscordRest:searchGuildMembers (guildId, options, botToken)
Get a list of guild members whose username or nickname starts with a provided string.

Parameters:

  • guildId The ID of the guild to search in.
  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of guild members that matched the query.

See also:

Usage:

    discord:searchGuildMembers("[guild ID]", {query = "Po"}):next(function(members) ... end)

Invite

DiscordRest:deleteInvite (inviteCode, botToken)
Delete an invite.

Parameters:

  • inviteCode The code of the invite that will be deleted.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteInvite("[invite code]")
DiscordRest:getInvite (inviteCode, options, botToken)
Return info for an invite.

Parameters:

  • inviteCode The code of the invite.
  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the invite info.

See also:

Usage:

    discord:getInvite("[invite code]", {with_expiration = true}):next(function(invite) ... end)

User

DiscordRest:createDm (recipientId, botToken)
Create a new DM channel with a user.

Parameters:

  • recipientId The ID of the user to start the DM with.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that is resolved with the DM channel information.

See also:

Usage:

    discord:createDm("[recipient ID]"):next(function(channel) ... end)
DiscordRest:getCurrentUser (botToken)
Get the current user's information.

Parameters:

  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the user's information.

See also:

Usage:

    discord:getCurrentUser():next(function(user) ... end)
DiscordRest:getCurrentUserGuilds (options, botToken)
Get the current user's guilds.

Parameters:

  • options Options for the query.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of guilds.

See also:

Usage:

    discord:getCurrentUserGuilds({limit = 10}):next(function(guilds) ... end)
DiscordRest:getUser (userId, botToken)
Get user information.

Parameters:

  • userId The ID of the user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:getUser("[user ID]"):next(function(user) ... end)
DiscordRest:getUserConnections (botToken)
Get a list of the current user's connections.

Parameters:

  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of connections.

See also:

Usage:

    discord:getUserConnections():next(function(connections) ... end)
DiscordRest:leaveGuild (guildId, botToken)
Leave a guild.

Parameters:

  • guildId The ID of the guild to leave.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:leaveGuild("[guild ID]")
DiscordRest:modifyCurrentUser (params, botToken)
Modify the requester's user account settings.

Parameters:

  • params Parameters to modify.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the modified user.

See also:

Usage:

    discord:modifyCurrentUser({username = "New Username"}):next(function(user) ... end)

Webhook

DiscordRest:deleteWebhook (webhookId, botToken)
Delete a webhook.

Parameters:

  • webhookId The ID of the webhook.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteWebhook("[webhook ID]")
DiscordRest:deleteWebhookMessage (webhookId, webhookToken, messageId)
Deletes a message that was created by the webhook.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.
  • messageId The ID of the message.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteWebhookMessage("[webhook ID]", "[webhook token]", "[message ID]")
DiscordRest:deleteWebhookWithToken (webhookId, webhookToken)
Delete a webhook, using its token for authorization instead of a bot token.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteWebhookWithToken("[webhook ID]", "[webhook token]")
DiscordRest:deleteWebhookWithUrl (url)
Delete a webhook, using its full URL for authorization instead of a bot token.

Parameters:

  • url The URL of the webhook.

Returns:

    A new promise.

See also:

Usage:

    discord:deleteWebhookWithUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]")
DiscordRest:editWebhookMessage (webhookId, webhookToken, messageId, params)
Edits a previously-sent webhook message from the same token.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.
  • messageId The ID of the message.
  • params Parameters to modify.

Returns:

    A new promise which is resolved with the updated message.

See also:

Usage:

    discord:editWebhookMessage("[webhook ID]", "[webhook token]", "[message ID]", {content = "New content"}):next(function(message) ... end)
DiscordRest:executeGitHubCompatibleWebhook (webhookId, webhookToken, data, options)
Execute a GitHub webhook.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.
  • data The data to send.
  • options Options for the webhook execution.

Returns:

    A new promise.

See also:

Usage:

    discord:executeGitHubCompatibleWebhook("[webhook ID]", "[webhook token]", {...})
DiscordRest:executeGitHubCompatibleWebhookUrl (url, data, options)
Execute a GitHub webhook, using the full URL.

Parameters:

  • url The URL of the webhook.
  • data The data to send.
  • options Options for the webhook execution.

Returns:

    A new promise.

See also:

Usage:

    discord:executeGitHubCompatibleWebhookUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]/github", {...})
DiscordRest:executeSlackCompatibleWebhook (webhookId, webhookToken, data, options)
Execute a Slack webhook.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.
  • data The data to send.
  • options Options for the webhook execution.

Returns:

    A new promise.

See also:

Usage:

    discord:executeSlackCompatibleWebhook("[webhook ID]", "[webhook token]", {text = "hello"})
DiscordRest:executeSlackCompatibleWebhookUrl (url, data, options)
Execute a Slack webhook, using the full URL.

Parameters:

  • url The webhook URL.
  • data The data to send.
  • options Options for the webhook execution.

Returns:

    A new promise.

See also:

Usage:

    discord:executeSlackCompatibleWebhookUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]/slack", {text = "hello"})
DiscordRest:executeWebhook (webhookId, webhookToken, data, options)
Execute a webhook.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token for the webhook.
  • data The data to send.
  • options Options for the webhook execution.

Returns:

    A new promise.

See also:

Usage:

    discord:executeWebhook("[webhook ID]", "[webhook token]", {content = "Hello, world!"})
DiscordRest:executeWebhookUrl (url, data, options)
Execute a webhook, using the full URL.

Parameters:

  • url The webhook URL.
  • data The data to send.
  • options Options for the webhook execution.

Returns:

    A new promise.

See also:

Usage:

    discord:executeWebhookUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]", {content = "Hello, world!"})
DiscordRest:getChannelWebhooks (channelId, botToken)
Get a list of webhooks for a channel.

Parameters:

  • channelId The ID of the channel.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of webhooks.

See also:

Usage:

    discord:getChannelWebhooks("[channel ID]"):next(function(webhooks) ... end)
DiscordRest:getGuildWebhooks (guildId, botToken)
Get a list of webhooks for a guild.

Parameters:

  • guildId The ID of the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with a list of webhooks.

See also:

Usage:

    discord:getGuildWebhooks("[guild ID]"):next(function(webhooks) ... end)
DiscordRest:getWebhook (webhookId, botToken)
Get information for a webhook.

Parameters:

  • webhookId The ID of the webhook.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the webhook.

See also:

Usage:

    discord:getWebhook("[webhook ID]"):next(function(webhook) ... end)
DiscordRest:getWebhookMessage (webhookId, webhookToken, messageId)
Returns a previously-sent webhook message from the same token.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.
  • messageId The ID of the message.

Returns:

    A new promise which is resolved with the message.

See also:

Usage:

    discord:getWebhookMessage("[webhook ID]", "[webhook token]", "[message ID]"):next(function(message) ... end)
DiscordRest:getWebhookWithToken (webhookId, webhookToken)
Get information for a webhook, using its token for authorization instead of a bot token.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.

Returns:

    A new promise which is resolved with the webhook.

See also:

Usage:

    discord:getWebhookWithToken("[webhook ID]", "[webhook token]"):next(function(webhook) ... end)
DiscordRest:getWebhookWithUrl (url)
Get information for a webhook, using its full URL for authorization instead of a bot token.

Parameters:

  • url The webhook URL.

Returns:

    A new promise which is resolved with the webhook.

See also:

Usage:

    discord:getWebhookWithUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]"):next(function(webhook) ... end)
DiscordRest:modifyWebhook (webhookId, params, botToken)
Modify a webhook.

Parameters:

  • webhookId The ID of the webhook.
  • params Parameters to modify.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the updated webhook.

See also:

Usage:

    discord:modifyWebhook("[webhook ID]", {name = "New name"}):next(function(webhook) ... end)
DiscordRest:modifyWebhookWithToken (webhookId, webhookToken, params)
Modify a webhook, using its token for authorization instead of a bot token.

Parameters:

  • webhookId The ID of the webhook.
  • webhookToken The token of the webhook.
  • params Parameters to modify.

Returns:

    A new promise which is resolved with the updated webhook.

See also:

Usage:

    discord:modifyWebhookWithToken("[webhook ID]", "[webhook token]", {name = "New name"}):next(function(webhook) ... end)
DiscordRest:modifyWebhookWithUrl (url, params)
Modify a webhook, using its full URL for authorization instead of a bot token.

Parameters:

  • url The URL of the webhook.
  • params Parameters to modify.

Returns:

    A new promise which is resolved with the updated webhook.

See also:

Usage:

    discord:modifyWebhookWithUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]", {name = "New name"}):next(function(webhook) ... end)

Player

Wrapper functions that allow you to use a player's server ID in place of a Discord user ID.
DiscordRest:getUserId (player)
Get the Discord user ID of a player.

Parameters:

  • player The server ID of the player.

Returns:

    A new promise which is resolved with the player's Discord user ID, if they have one.

Usage:

    discord:getUserId(1):next(function(userId) ... end)
DiscordRest:addGuildMemberRoleToPlayer (guildId, player, roleId, botToken)
Adds a guild role to a player.

Parameters:

  • guildId The ID of the guild.
  • player The server ID of the player to add the role to.
  • roleId The ID of the role to add to the member.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:addGuildMemberRoleToPlayer("[guild ID]", 1, "[role ID]")
DiscordRest:addPlayerToGuild (guildId, player, params, botToken)
Adds a player to a guild.

Parameters:

  • guildId The ID of the guild to add the user to.
  • player The server ID of the player to add to the guild.
  • params Parameters for adding the user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:addPlayerToGuild("[guild ID]", 1, {access_token = "..."})
DiscordRest:addPlayerToThread (channelId, player, botToken)
Adds a player to a thread.

Parameters:

  • channelId The ID of the thread channel.
  • player The server ID of the player to add to the thread.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:addPlayerToThread("[channel ID]", 1)
DiscordRest:createGuildBanForPlayer (guildId, player, params, botToken)
Create a guild ban for a player.

Parameters:

  • guildId The ID of the guild to create the ban for.
  • player The server ID of the player to ban.
  • params Parameters for the ban.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:createGuildBanForPlayer("[guild ID]", 1, {reason = "Not following the rules"})
DiscordRest:deletePlayerReaction (channelId, messageId, emoji, player, botToken)
Remove a player's reaction from a message.

Parameters:

  • channelId The ID of the channel containing the message.
  • messageId The message to remove the reaction from.
  • emoji The emoji of the reaction to remove.
  • player The server ID of the player whose reaction will be removed.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:deletePlayerReaction("[channel ID]", "[message ID]", "💗", 1)
DiscordRest:getGuildBanForPlayer (guildId, player, botToken)
Return info on a ban for a player in a guild.

Parameters:

  • guildId The ID of the guild.
  • player The server ID of the banned player.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the ban info.

See also:

Usage:

    discord:getGuildBanForPlayer("[guild ID]", 1):next(function(ban) ... end)
DiscordRest:getGuildMemberForPlayer (guildId, player, botToken)
Get guild membership info for a player.

Parameters:

  • guildId The ID of the guild.
  • player The server ID of the player.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise that resolves with the info of the member if they are in the guild.

See also:

Usage:

    discord:getGuildMember("[guild ID]", 1):next(function(member) ... end)
DiscordRest:getUserForPlayer (player, botToken)
Get user information for a player.

Parameters:

  • player The server ID of the player.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:getUserForPlayer(1):next(function(user) ... end)
DiscordRest:groupDmAddPlayer (channelId, player, params, botToken)
Adds a player to a Group DM.

Parameters:

  • channelId The ID of the group DM channel.
  • player The server ID of the player to add.
  • params Parameters for adding the user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:groupDmAddPlayer("[channel ID]", 1, {access_token = "..."})
DiscordRest:groupDmRemovePlayer (channelId, player, botToken)
Removes a player from a Group DM.

Parameters:

  • channelId The ID of the group DM channel.
  • player The server ID of the player to remove.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:groupDmRemovePlayer("[channel ID]", 1)
DiscordRest:modifyGuildMemberForPlayer (guildId, player, params, botToken)
Modify guild membership attributes of a player.

Parameters:

  • guildId The ID of the guild.
  • player The server ID of the player.
  • params The parameters to modify.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise which is resolved with the modified guild member.

See also:

Usage:

    discord:modifyGuildMember("[guild ID]", 1, {nick = "New nickname"})
DiscordRest:modifyPlayerVoiceState (guildId, player, params, botToken)
Updates a player's voice state.

Parameters:

  • guildId The ID of the guild.
  • player The server ID of the player.
  • params Parameters for modifying the voice state.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:modifyPlayerVoiceState("[guild ID]", 1, {...})
DiscordRest:removeGuildBanForPlayer (guildId, player, botToken)
Remove a guild ban for a player.

Parameters:

  • guildId The ID of the guild to remove the ban for the user from.
  • player The server ID of the user to unban.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removeGuildBanForPlayer("[guild ID]", 1)
DiscordRest:removeGuildMemberRoleFromPlayer (guildId, player, roleId, botToken)
Removes a guild role from a player.

Parameters:

  • guildId The ID of the guild.
  • player The server ID of the player to remove the role from.
  • roleId The ID of the role to remove from the member.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removeGuildMemberRoleFromPlayer("[guild ID]", 1, "[role ID]")
DiscordRest:removePlayerFromGuild (guildId, player, botToken)
Remove a player from a guild.

Parameters:

  • guildId The ID of the guild to remove the member from.
  • player The server ID of the player to remove from the guild.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removePlayerFromGuild("[guild ID]", 1)
DiscordRest:removePlayerFromThread (channelId, player, botToken)
Remove a player from a thread.

Parameters:

  • channelId The ID of the thread channel.
  • player The server ID of the player to remove from the thread.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    discord:removePlayerFromThread("[channel ID]", 1)
generated by LDoc 1.4.6 Last updated 2023-11-29 20:06:29