Module exports

Discord REST API export functions

Channel

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

Emoji

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

Guild

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

Invite

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

User

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

Webhook

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

Player

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


Channel

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:

    exports.discord_rest:addThreadMember("[channel ID]", "[user ID]")
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:

    exports.discord_rest:bulkDeleteMessages("[channel ID]", {"[message ID 1]", "[message ID 2]", ...}, "[bot token]")
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:

    exports.discord_rest:createChannelInvite("[channel ID]", {max_age = 3600, max_uses = 1})
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:

    exports.discord_rest:createMessage("[channel ID]", {content = "Hello, world!"}, "[bot token]")
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 name of 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:

    exports.discord_rest:createReaction("[channel ID]", "[message ID]", "💗", "[bot token]")
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:

    exports.discord_rest:crosspostMessage("[channel ID]", "[message ID]", "[bot token]")
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:

    exports.discord_rest:deleteAllReactions("[channel ID]", "[message ID]", "[bot token]")
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:

    exports.discord_rest:deleteAllReactionsForEmoji("[channel ID]", "[message ID]", "💗", "[bot token]")
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:

    exports.discord_rest:deleteChannel("[channel ID]", "[bot token]")
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:

    exports.discord_rest:deleteChannelPermission("[channel ID]", "[overwrite ID]", "[bot token]")
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:

    exports.discord_rest:deleteMessage("[channel ID]", "[message ID]", "[bot token]")
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:

    exports.discord_rest:deleteOwnReaction("[channel ID]", "[message ID]", "💗", "[bot token]")
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 ID of 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:

    exports.discord_rest:deleteOwnReaction("[channel ID]", "[message ID]", "💗", "[bot token]")
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:

    exports.discord_rest:editChannelPermissions("[channel ID]", "[overwrite ID]", {allow = 6, deny = 8, type = 0})
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:

    exports.discord_rest:editMessage("[channel ID]", "[message ID]", {content = "I edited this message!"}, "[bot token]")
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:

    exports.discord_rest:followNewsChannel("[channel ID]", "[target channel ID]", "[bot token]")
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:

    exports.discord_rest:getChannel("[channel ID]", "[bot token]"):next(function(channel) ... end)
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:

    exports.discord_rest:getChannelInvites("[channel ID]", "[bot token]"):next(function(invites) ... end)
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:

    exports.discord_rest:getChannelMessage("[channel ID]", "[messageId]", "[bot token]")
getChannelMessages (channelId, options, botToken)
Get messages from a channel.

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:

    exports.discord_rest:getChannelMessages("[channel ID]", {limit = 1}, "[bot token]"):next(function(messages) ... end)
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:

    exports.discord_rest:getPinnedMessages("[channel ID]", "[bot token]")
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:

    exports.discord_rest:getReactions("[channel ID]", "[message ID]", "💗", nil, "[bot token]"):next(function(users) ... end)
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:

    exports.discord_rest:groupDmAddRecipient("[channel ID]", "[user ID]", {access_token = "..."}, "[bot token]")
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:

    exports.discord_rest:groupDmRemoveRecipient("[channel ID]", "[user ID]", "[bot token]")
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:

    exports.discord_rest:joinThread("[channel ID]", "[bot token]")
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:

    exports.discord_rest:leaveThread("[channel ID]", "[bot token]")
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 list of information on active threads.

See also:

Usage:

    exports.discord_rest:listActiveThreads("[channel ID]"):next(function(data) ... end)
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:

    exports.discord_rest:listJoinedPrivateArchivedThreads("[channel ID]", {limit = 5}, "[bot token]"):next(function(data) ... end)
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:

    exports.discord_rest:listPrivateArchivedThreads("[channel ID]", {limit = 5}, "[bot token]"):next(function(data) ... end)
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 for.
  • 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:

    exports.discord_rest:listPublicArchivedThreads("[channel ID]", {limit = 5}, "[bot token]"):next(function(data) ... end)
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:

    exports.discord_rest:listThreadMembers("[channel ID]", "[bot token]"):next(function(members) ... end)
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:

    exports.discord_rest:modifyChannel("[channel ID]", {name = "new-name"}, "[bot token]")
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:

    exports.discord_rest:pinMessage("[channel ID]", "[message ID]", "[bot token]")
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:

    exports.discord_rest:removeThreadMember("[channel ID]", "[user ID]", "[bot token]")
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:

    exports.discord_rest:startThreadWithMessage("[channel ID]", "[message ID]", {name = "New thread"}, "[bot token]")
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:

    exports.discord_rest:startThreadWithoutMessage("[channel ID]", {name = "New thread"}, "[bot token]"):next(function(channel) ... end)
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:

    exports.discord_rest:triggerTypingIndicator("[channel ID]", "[bot token]")
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:

    exports.discord_rest:unpinMessage("[channel ID]", "[message ID]", "[bot token]")

Emoji

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:

    exports.discord_rest:createGuildEmoji("[guild ID]", {name = "emojiname", image = "data:image/jpeg;base64,..."}, "[bot token]")
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:

    exports.discord_rest:deleteGuildEmoji("[guild ID]", "[emoji ID]", "[bot token]")
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:

    exports.discord_rest:getGuildEmoji("[guild ID]", "[emoji ID]"):next(function(emoji) ... end)
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:

    exports.discord_rest:listGuildEmojis("[guild ID]", "[bot token]"):next(function(emojis) ... end)
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:

    exports.discord_rest:modifyGuildEmoji("[guild ID]", "[emoji ID]", {name = "newemojiname"}, "[bot token]")

Guild

addGuildMember (guildId, userId, param, 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.
  • param Parameters for adding the user.
  • botToken Optional bot token to use for authorization.

Returns:

    A new promise.

See also:

Usage:

    exports.discord_rest:addGuildMember("[guild ID]", "[user ID]", {access_token = "..."}, "[bot token]")
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:

    exports.discord_rest:addGuildMemberRole("[guild ID]", "[user ID]", "[role ID]", "[bot token]")
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:

    exports.discord_rest:beginGuildPrune("[guild ID]", nil, "[bot token]"):next(function(pruned) ... end)
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:

    exports.discord_rest:createGuild({name = "My Guild"})
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:

    exports.discord_rest:createGuildBan("[guild ID]", "[user ID]", {reason = "Not following the rules"}, "[bot token]")
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:

    exports.discord_rest:createGuildChannel(["guild ID"], {name = "new-channel"}, "[bot token]"):next(function(channel) ... end)
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:

    exports.discord_rest:createGuildRole("[guild ID]", {name = "Moderator", ...}, "[bot token]"):next(function(role) ... end)
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:

    exports.discord_rest:deleteGuild("[guild ID]", "[bot token]")
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:

    exports.discord_rest:deleteGuildIntegration("[guild ID]", "[integration ID]", "[bot token]")
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:

    exports.discord_rest:deleteGuildRole("[guild ID]", "[role ID]", "[bot token]")
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:

    exports.discord_rest:getGuild("[guild ID]"):next(function(guild) ... end)
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:

    exports.discord_rest:getGuildBan("[guild ID]", "[user ID]", "[bot token]"):next(function(ban) ... end)
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:

    exports.discord_get:getGuildBans("[guild ID]", "[bot token]"):next(function(bans) ... end)
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:

    exports.discord_rest:getGuildChannels("[guild ID]", "[bot token]"):next(function(channels) ... end)
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:

    exports.discord_rest:getGuildIntegrations("[guild ID]", "[bot token]"):next(function(integrations) ... end)
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:

    exports.discord_rest:getGuildInvites("[guild ID]", "[bot token]"):next(function(invites) ... end)
getGuildMember (guildId, userId, botToken)
Get info for a member of a guild.

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:

    exports.discord_rest:getGuildMember("[guild ID]", "[user ID]", "[bot token]"):next(function(member) ... end)
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:

    exports.discord_rest:getGuildPreview("[guild ID]", "[bot token]"):next(function(preview) ... end)
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:

    exports.discord_rest:getGuildPruneCount("[guild ID]", nil, "[bot token]"):next(function(pruned) ... end)
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:

    exports.discord_rest:getGuildRoles("[guild ID]"):next(function(roles) ... end)
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:

    exports.discord_rest:getGuildVanityUrl("[guild ID]", "[bot token]"):next(function(vanityUrl) ... end)
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:

    exports.discord_rest:getGuildVoiceRegions("[guild ID]", "[bot token]"):next(function(regions) ... end)
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:

    exports.discord_rest:getGuildWelcomeScreen("[guild ID]", "[bot token]"):next(function(welcomeScreen) ... end)
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:

    exports.discord_rest:getGuildWidget("[guild ID]"):next(function(widget) ... end)
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:

    exports.discord_rest:getGuildWidgetImage("[guild ID]", "shield"):next(function(image) ... end)
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:

    exports.discord_rest:getGuildWidgetSettings("[guild ID]", "[bot token]"):next(function(settings) ... end)
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:

    exports.discord_rest:listActiveGuildThreads("[guild ID]", "[bot token]"):next(function(data) ... end)
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:

    exports.discord_rest:listGuildMembers("[guild ID]", {limit = 5}, "[bot token]"):next(function(members) ... end)
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:

    exports.discord_rest:modifyCurrentUserNick("[guild ID]", "New nickname")
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:

    exports.discord_rest:modifyCurrentUserVoiceState("[guild ID]", {...}, "[bot token]")
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:

    exports.discord_rest:modifyGuild("[guild ID]", {name = "New guild name"}, "[bot token]")
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:

    exports.discord_rest:modifyGuildChannelPositions("[guild ID]", {{id = "[channel 1 ID]", position = 2}, {"[channel 2 ID]", position = 1}}, "[bot token]")
modifyGuildMember (guildId, userId, params, botToken)
Modify attributes of a guild member.

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:

    exports.discord_rest:modifyGuildMember("[guild ID]", "[user ID]", {nick = "New nickname"}, "[bot token]")
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:

    exports.discord_rest:modifyGuildRole("[guild ID]", "[role ID]", {name = "New role name"}, "[bot token]")
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:

    exports.discord_rest:modifyGuildRolePositions("[guild ID]", {{"[role ID 1]", 2}, {"[role ID 2]", 3}, ...}, "[bot token]")
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:

    exports.discord_rest:modifyGuildWelcomeScreen("[guild ID]", {enabled = true}, "[bot token]"):next(function(welcomeScreen) ... end)
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:

    exports.discord_rest:modifyGuildWidget("[guild ID]", {...}, "[bot token]"):next(function(widget) ... end)
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:

    exports.discord_rest:modifyUserVoiceState("[guild ID]", "[user ID]", {...}, "[bot token]")
removeGuildBan (guildId, userId, botToken)
Remove the 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:

    exports.discord_rest:removeGuildBan("[guild ID]", "[user ID]", "[bot token]")
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:

    exports.discord_rest:removeGuildMember("[guild ID]", "[user ID]", "[bot token]")
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:

    exports.discord_rest:removeGuildMemberRole("[guild ID]", "[user ID]", "[role ID]", "[bot token]")
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:

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

Invite

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:

    exports.discord_rest:deleteInvite("[invite code]", "[bot token]")
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:

    exports.discord_rest:getInvite("[invite code]", {with_expiration = true}, "[bot token]"):next(function(invite) ... end)

User

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:

    exports.discord_rest:createDm("[recipient ID]", "[bot token]"):next(function(channel) ... end)
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:

    exports.discord_rest:getCurrentUser("[bot token]"):next(function(user) ... end)
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:

    exports.discord_rest:getCurrentUserGuilds({limit = 10}, "[bot token]"):next(function(guilds) ... end)
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:

    exports.discord_rest:getUser("[user ID]", "[bot token]"):next(function(user) ... end)
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:

    exports.discord_rest:getUserConnections("[bot token]"):next(function(connections) ... end)
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:

    exports.discord_rest:leaveGuild("[guild ID]", "[bot token]")
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:

    exports.discord_rest:modifyCurrentUser({username = "New Username"}, "[bot token]"):next(function(user) ... end)

Webhook

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:

    exports.discord_rest:deleteWebhook("[webhook ID]", "[bot token]")
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:

    exports.discord_rest:deleteWebhookMessage("[webhook ID]", "[webhook token]", "[message ID]")
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:

    exports.discord_rest:deleteWebhookWithToken("[webhook ID]", "[webhook token]")
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:

    exports.discord_rest:deleteWebhookWithUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]")
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:

    exports.discord_rest:editWebhookMessage("[webhook ID]", "[webhook token]", "[message ID]", {content = "New content"}):next(function(message) ... end)
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:

    exports.discord_rest:executeGitHubCompatibleWebhook("[webhook ID]", "[webhook token]", {...})
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:

    exports.discord_rest:executeGitHubCompatibleWebhookUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]/github", {...})
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:

    exports.discord_rest:executeSlackCompatibleWebhook("[webhook ID]", "[webhook token]", {text = "hello"})
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:

    exports.discord_rest:executeSlackCompatibleWebhookUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]/slack", {text = "hello"})
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:

    exports.discord_rest:executeWebhook("[webhook ID]", "[webhook token]", {content = "Hello, world!"})
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:

    exports.discord_rest:executeWebhookUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]", {content = "Hello, world!"})
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:

    exports.discord_rest:getChannelWebhooks("[channel ID]", "[bot token]"):next(function(webhooks) ... end)
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:

    exports.discord_rest:getGuildWebhooks("[guild ID]", "[bot token]"):next(function(webhooks) ... end)
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:

    exports.discord_rest:getWebhook("[webhook ID]", "[bot token]"):next(function(webhook) ... end)
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:

    exports.discord_rest:getWebhookMessage("[webhook ID]", "[webhook token]", "[message ID]"):next(function(message) ... end)
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:

    exports.discord_rest:getWebhookWithToken("[webhook ID]", "[webhook token]"):next(function(webhook) ... end)
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:

    exports.discord_rest:getWebhookWithUrl("https://discord.com/api/webhooks/[webhook ID]/[webhook token]"):next(function(webhook) ... end)
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:

    exports.discord_rest:modifyWebhook("[webhook ID]", {name = "New name"}, "[bot token]"):next(function(webhook) ... end)
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:

    exports.discord_rest:modifyWebhookWithToken("[webhook ID]", "[webhook token]", {name = "New name"}):next(function(webhook) ... end)
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:

    exports.discord_rest: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.
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:

    exports.discord_rest:addGuildMemberRoleToPlayer("[guild ID]", 1, "[role ID]", "[bot token]")
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:

    exports.discord_rest:addPlayerToGuild("[guild ID]", 1, {access_token = "..."}, "[bot token]")
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:

    exports.discord_rest:addPlayerToThread("[channel ID]", 1, "[bot token]")
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:

    exports.discord_rest:createGuildBanForPlayer("[guild ID]", 1, {reason = "Not following the rules"}, "[bot token]")
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:

    exports.discord_rest:deletePlayerReaction("[channel ID]", "[message ID]", "💗", 1, "[bot token]")
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:

    exports.discord_rest:getGuildBanForPlayer("[guild ID]", 1, "[bot token]"):next(function(ban) ... end)
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:

    exports.discord_rest:getGuildMemberForPlayer("[guild ID]", 1, "[bot token]"):next(function(member) ... end)
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:

    exports.discord_rest:getUserForPlayer(1, "[bot token]"):next(function(user) ... end)
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:

    exports.discord_rest:getUserId(1):next(function(userId) ... end)
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:

    exports.discord_rest:groupDmAddPlayer("[channel ID]", 1, {access_token = "..."}, "[bot token]")
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:

    exports.discord_rest:groupDmRemovePlayer("[channel ID]", 1, "[bot token]")
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:

    exports.discord_rest:modifyGuildMemberForPlayer("[guild ID]", 1, {nick = "New nickname"}, "[bot token]")
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:

    exports.discord_rest:modifyPlayerVoiceState("[guild ID]", 1, {...}, "[bot token]")
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:

    exports.discord_rest:removeGuildBanForPlayer("[guild ID]", 1, "[bot token]")
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:

    exports.discord_rest:removeGuildMemberRoleFromPlayer("[guild ID]", 1, "[role ID]", "[bot token]")
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:

    exports.discord_rest:removePlayerFromGuild("[guild ID]", 1, "[bot token]")
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:

    exports.discord_rest:removePlayerFromThread("[channel ID]", 1, "[bot token]")
generated by LDoc 1.4.6 Last updated 2023-11-29 20:06:29