Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/discordeno/helpers/mod.ts

Discord API library for Deno
Go to Latest
import * as discordeno from "https://deno.land/x/discordeno@13.0.0-rc45/helpers/mod.ts";

Functions

Add a discovery subcategory to the guild. Requires the MANAGE_GUILD permission.

Create a reaction for the message. Reaction takes the form of name:id for custom guild emoji, or Unicode characters. Requires READ_MESSAGE_HISTORY and ADD_REACTIONS

Adds multiple reactions to a message. If ordered is true(default is false), it will add the reactions one at a time in the order provided. Note: Reaction takes the form of name:id for custom guild emoji, or Unicode characters. Requires READ_MESSAGE_HISTORY and ADD_REACTIONS

Add a role to the member

Adds a user to a thread. Requires the ability to send messages in the thread. Requires the thread is not archived.

The users custom avatar or the default avatar if you don't have a member object.

Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission.

Connect or join a voice channel inside a guild. By default, the "selfDeaf" option is true. Requires CONNECT and VIEW_CHANNEL permissions.

There are two kinds of Application Commands: global commands and guild commands. Global commands are available for every guild that adds your app; guild commands are specific to the guild you specify when making them. Command names are unique per application within each scope (global and guild). That means:

Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server.

Create an emoji in the server

Creates a new public thread from an existing message. Returns a thread channel.

Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds.

Create a new guild based on a template NOTE: This endpoint can be used only by bots in less than 10 guilds.

Creates a template for the guild. Requires the MANAGE_GUILD permission.

Creates a new invite for this channel. Requires CREATE_INSTANT_INVITE

Create a new role for the guild. Requires the MANAGE_ROLES permission.

Create a guild scheduled event in the guild. A guild can have a maximum of 100 events with SCHEDULED or ACTIVE status at any time.

Creates a new Stage instance associated to a Stage channel. Requires the user to be a moderator of the Stage channel.

Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:

Deletes a application command.

Delete a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. Bot needs MANAGE_THREADS permissions in the server if deleting thread.

Delete the channel permission overwrites for a user or role in this channel. Requires MANAGE_ROLES permission.

Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns 204 No Content on success.

Deletes a followup message for an Interaction. Functions the same as delete webhook message, however this uses your interaction token instead of bot token. Does not support ephemeral followups.

Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event.

Deletes a template from a guild. Requires the MANAGE_GUILD permission.

Delete the attached integration object for the guild with this id. Requires MANAGE_GUILD permission.

To delete your response to a application command. If a message id is not provided, it will default to deleting the original response.

Deletes an invite for the given code. Requires MANAGE_CHANNELS or MANAGE_GUILD permission

Delete a message with the channel id and message id only.

Delete messages from the channel. 2-100. Requires the MANAGE_MESSAGES permission

Delete a guild role. Requires the MANAGE_ROLES permission.

Delete a scheduled event.

Deletes the Stage instance. Requires the user to be a moderator of the Stage channel.

Delete a webhook permanently. Requires the MANAGE_WEBHOOKS permission. Returns a undefined on success

Delete a webhook permanently. Returns a undefined on success

Edits command permissions for a specific command for your application in a guild.

Edit the nickname of the bot in this guild

Modifies the bot's username or avatar. NOTE: username: if changed may cause the bot's discriminator to be randomized.

Update a channel's settings. Requires the MANAGE_CHANNELS permission for the guild.

Edit the channel permission overwrites for a user or role in this channel. Requires MANAGE_ROLES permission.

Modify the discovery metadata for the guild. Requires the MANAGE_GUILD permission. Returns the updated discovery metadata object on success.

Modify the given emoji. Requires the MANAGE_EMOJIS permission.

Edits a followup message for an Interaction. Functions the same as edit webhook message, however this uses your interaction token instead of bot token. Does not support ephemeral followups.

Modify a guilds settings. Requires the MANAGE_GUILD permission.

Edit a template's metadata. Requires the MANAGE_GUILD permission.

To edit your response to a application command. If a messageId is not provided it will default to editing the original response.

Edit the member

Edit the message.

Edit a guild role. Requires the MANAGE_ROLES permission.

Modify a guild scheduled event. To start or end an event, use this endpoint to modify the event's status.

Edit a webhook. Requires the MANAGE_WEBHOOKS permission. Returns the updated webhook object on success.

Edit a webhook. Returns the updated webhook object on success.

Modify a guild widget object for the guild. Requires the MANAGE_GUILD permission.

Creates a url to the emoji from the Discord CDN.

Highly recommended to use this function to fetch members instead of getMember from REST. REST: 50/s global(across all shards) rate limit with ALL requests this included GW(this function): 120/m(PER shard) rate limit. Meaning if you have 8 shards your limit is now 960/m.

Follow a News Channel to send messages to a target channel. Requires the MANAGE_WEBHOOKS permission in the target channel. Returns the webhook id.

Returns all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order.

Fetches the global command for the given Id. If a guildId is provided, the guild command will be fetched.

Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object.

Fetches command permissions for all commands for your application in a guild. Returns an array of GuildApplicationCommandPermissions objects.

Fetch all the commands for your application. If a guild id is not provided, it will fetch global commands.

Get the applications info

Get the archived threads for this channel, defaults to public

Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission

Returns an array of voice regions that can be used when creating servers.

Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission.

Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission.

Fetches a single channel object from the api.

Gets the invites for this channel. Requires MANAGE_CHANNEL

Returns a list of guild channel objects.

Gets the webhooks for this channel. Requires MANAGE_WEBHOOKS

Returns the discovery metadata object for the guild. Requires the MANAGE_GUILD permission.

Returns a Collection (mapped by Id of the discovery category object) of discovery category objects that can be used when editing guilds

Get a user's dm channel. This is required in order to send a DM.

Returns an emoji for the given guild and emoji Id.

Returns a list of emojis for the given guild.

Returns a followup message for an Interaction. Functions the same as get webhook message, however this uses your interaction token instead of bot token. Does not support ephemeral followups.

Get the bots Gateway metadata that can help during the operation of large or sharded bots.

This function fetches a guild's data. This is not the same data as a GUILD_CREATE. So it does not cache the guild, you must do it manually.

Returns the guild preview object for the given id. If the bot is not in the guild, then the guild must be Discoverable.

Returns an array of templates. Requires the MANAGE_GUILD permission.

Returns a list of integrations for the guild. Requires the MANAGE_GUILD permission.

Returns an invite for the given code or throws an error if the invite doesn't exists.

Get all the invites for this guild. Requires MANAGE_GUILD permission

Returns a guild member object for the specified user.

Highly recommended to NOT use this function to get members instead use fetchMembers(). REST(this function): 50/s global(across all shards) rate limit with ALL requests this included GW(fetchMembers): 120/m(PER shard) rate limit. Meaning if you have 8 shards your limit is 960/m.

Fetch a single message from the server. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY

Fetches between 2-100 messages. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY

Returns the initial Interaction response. Functions the same as Get Webhook Message

Get pinned messages in this channel.

Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission

Get a list of users that reacted with this emoji.

Returns a list of role objects for the guild.

Get a guild scheduled event.

Get a list of guild scheduled event for the given guild.

Gets the stage instance associated with the Stage channel, if it exists.

Returns the guild template if it exists

Returns thread members objects that are members of the thread.

Returns thread members objects that are members of the thread.

This function will return the raw user payload in the rare cases you need to fetch a user directly from the API.

Returns the code and uses of the vanity url for this server if it is enabled else code will be null. Requires the MANAGE_GUILD permission.

Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.

Returns the new webhook object for the given id.

Returns a previously-sent webhook message from the same token. Returns a message object on success.

Returns a list of guild webhooks objects. Requires the MANAGE_WEBHOOKs permission.

Returns the new webhook object for the given id, this call does not require authentication and returns no user in the webhook object.

Returns the Welcome Screen object for the guild. Requires the MANAGE_GUILD permission.

Returns the widget for the guild.

Returns the widget image URL for the guild.

Returns a guild widget settings object. Requires the MANAGE_GUILD permission.

The full URL of the banner from Discords CDN. Undefined if no banner is set.

The full URL of the icon from Discords CDN. Undefined when no icon is set.

The full URL of the splash from Discords CDN. Undefined if no splash is set.

Adds the bot to the thread. Cannot join an archived thread.

Kick a member from the server

Leave a guild

Removes the bot from a thread. Requires the thread is not archived.

Modify the positions of a set of role objects for the guild. Requires the MANAGE_ROLES permission. Returns a list of all of the guild's role objects on success. Fires multiple Guild Role Update Gateway events.

Returns the list of sticker packs available to Nitro subscribers.

Pin a message in a channel. Requires MANAGE_MESSAGES. Max pins allowed in a channel = 50.

Begin a prune operation. Requires the KICK_MEMBERS permission. Returns an object with one 'pruned' key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the computePruneCount option to false, forcing 'pruned' to null. Fires multiple Guild Member Remove Gateway events.

Crosspost a message in a News Channel to following channels.

Removes all reactions for all emojis on this message.

Removes a discovery subcategory from the guild. Requires the MANAGE_GUILD permission. Returns a 204 No Content on success.

Removes a reaction from the given user on this message, defaults to bot. Reaction takes the form of name:id for custom guild emoji, or Unicode characters.

Remove a role from the member

Removes a user from a thread. Requires the MANAGE_THREADS permission or that you are the creator of the thread. Also requires the thread is not archived.

Query string to match username(s) and nickname(s) against

Send a response to a users application command. The command data will have the id and token necessary to respond. Interaction tokens are valid for 15 minutes and can be used to send followup messages.

Send a message to the channel. Requires SEND_MESSAGES permission.

Send a webhook with webhook Id and webhook token

Creates a new public thread from an existing message. Returns a thread channel.

Creates a new private thread. Returns a thread channel.

Trigger a typing indicator for the specified channel. Generally bots should NOT implement this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message.

Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permission. Only channels to be modified are required.

Syncs the template to the guild's current state. Requires the MANAGE_GUILD permission.

Remove the ban for a user. Requires BAN_MEMBERS permission

Updates the bot's voice state Caveats:

  • channel_id must currently point to a stage channel.
  • Bot must already have joined channel_id.
  • You must have the MUTE_MEMBERS permission. But can always suppress yourself.
  • You must have the REQUEST_TO_SPEAK permission to request to speak. You can always clear your own request to speak.
  • You are able to set request_to_speak_timestamp to any present or future time.
  • When suppressed, the user will have their request_to_speak_timestamp removed.

Updates fields of an existing Stage instance. Requires the user to be a moderator of the Stage channel.

Updates the a user's voice state Caveats:

  • channel_id must currently point to a stage channel.
  • User must already have joined channel_id.
  • You must have the MUTE_MEMBERS permission. But can always suppress yourself.
  • When unsuppressed, non-bot users will have their request_to_speak_timestamp set to the current time. Bot users will not.
  • You must have the REQUEST_TO_SPEAK permission to request to speak. You can always clear your own request to speak.
  • You are able to set request_to_speak_timestamp to any present or future time.
  • When suppressed, the user will have their request_to_speak_timestamp removed.

Edit an existing application command. If this command did not exist, it will create it.

Bulk edit existing application commands. If a command does not exist, it will create it.

Interfaces