Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
456 changes: 235 additions & 221 deletions index.d.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Eris.Bucket = require("./lib/util/Bucket");
Eris.Call = require("./lib/structures/Call");
Eris.CategoryChannel = require("./lib/structures/CategoryChannel");
Eris.Channel = require("./lib/structures/Channel");
Eris.CommandInteraction = require("./lib/structures/CommandInteraction");
Eris.ComponentInteraction = require("./lib/structures/ComponentInteraction");
Eris.Client = Client;
Eris.Collection = require("./lib/util/Collection");
Eris.Command = require("./lib/command/Command");
Eris.CommandClient = require("./lib/command/CommandClient");
Eris.CommandInteraction = require("./lib/structures/CommandInteraction");
Eris.ComponentInteraction = require("./lib/structures/ComponentInteraction");
Eris.Constants = require("./lib/Constants");
Eris.DiscordHTTPError = require("./lib/errors/DiscordHTTPError");
Eris.DiscordRESTError = require("./lib/errors/DiscordRESTError");
Expand Down
48 changes: 24 additions & 24 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class Client extends EventEmitter {
* @arg {Object} [options.agent] [DEPRECATED] A HTTPS Agent used to proxy requests. This option has been moved under `options.rest`
* @arg {Object} [options.allowedMentions] A list of mentions to allow by default in createMessage/editMessage
* @arg {Boolean} [options.allowedMentions.everyone] Whether or not to allow @everyone/@here
* @arg {Boolean} [options.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to
* @arg {Boolean | Array<String>} [options.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow
* @arg {Boolean | Array<String>} [options.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow
* @arg {Boolean} [options.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to
* @arg {Boolean} [options.autoreconnect=true] Have Eris autoreconnect when connection is lost
* @arg {Boolean} [options.compress=false] Whether to request WebSocket data to be compressed or not
* @arg {Number} [options.connectionTimeout=30000] How long in milliseconds to wait for the connection to handshake with the server
Expand Down Expand Up @@ -285,10 +285,10 @@ class Client extends EventEmitter {
* @arg {String} userID The ID of the user
* @arg {String} accessToken The access token of the user
* @arg {Object} [options] Options for adding the member
* @arg {Boolean} [options.deaf] Whether the member should be deafened
* @arg {Boolean} [options.mute] Whether the member should be muted
* @arg {String} [options.nick] The nickname of the member
* @arg {Array<String>} [options.roles] Array of role IDs to add to the member
* @arg {Boolean} [options.mute] Whether the member should be muted
* @arg {Boolean} [options.deaf] Whether the member should be deafened
* @return {Promise}
*/
addGuildMember(guildID, userID, accessToken, options = {}) {
Expand Down Expand Up @@ -616,8 +616,8 @@ class Client extends EventEmitter {
* Create a channel webhook
* @arg {String} channelID The ID of the channel to create the webhook in
* @arg {Object} options Webhook options
* @arg {String} options.name The default name
* @arg {String} [options.avatar] The default avatar as a base64 data URI. Note: base64 strings alone are not base64 data URI strings
* @arg {String} options.name The default name
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Promise<Object>} Resolves with a webhook object
*/
Expand Down Expand Up @@ -874,10 +874,10 @@ class Client extends EventEmitter {
* @arg {String} channelID The ID of the channel
* @arg {String | Object} content A string or object. If an object is passed:
* @arg {Object} [content.allowedMentions] A list of mentions to allow (overrides default)
* @arg {Boolean} [content.allowedMentions.everyone] Whether or not to allow @everyone/@here.
* @arg {Boolean} [content.allowedMentions.everyone] Whether or not to allow @everyone/@here
* @arg {Boolean} [content.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to
* @arg {Boolean | Array<String>} [content.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow
* @arg {Boolean | Array<String>} [content.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow
* @arg {Boolean} [content.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to
* @arg {Array<Object>} [content.attachments] An array of attachment objects with the filename and description
* @arg {String} [content.attachments[].description] The description of the file
* @arg {String} [content.attachments[].filename] The name of the file
Expand Down Expand Up @@ -1473,9 +1473,9 @@ class Client extends EventEmitter {
* @arg {String} guildID The ID of the guild
* @arg {Array<Object>} channelPositions An array of [ChannelPosition](https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions)
* @arg {String} channelPositions[].id The ID of the channel
* @arg {Number} channelPositions[].position The new position of the channel
* @arg {Boolean} [channelPositions[].lockPermissions] Whether to sync the channel's permissions with the new parent, if changing parents
* @arg {String} [channelPositions[].parentID] The new parent ID (category channel) for the channel that is moved. For each request, only one channel can change parents
* @arg {Number} channelPositions[].position The new position of the channel
* @returns {Promise}
*/
editChannelPositions(guildID, channelPositions) {
Expand Down Expand Up @@ -1638,9 +1638,9 @@ class Client extends EventEmitter {
* Edit a guild's discovery data
* @arg {String} guildID The ID of the guild
* @arg {Object} [options] The guild discovery data
* @arg {String} [options.primaryCategoryID] The primary discovery category ID
* @arg {Array<String>} [options.keywords] The discovery keywords (max 10)
* @arg {Boolean} [options.emojiDiscoverabilityEnabled] Whether guild info should be shown when emoji info is loaded
* @arg {Array<String>} [options.keywords] The discovery keywords (max 10)
* @arg {String} [options.primaryCategoryID] The primary discovery category ID
* @arg {String} [options.reason] The reason to be displayed in audit logs
* @returns {Promise<Object>} The updated guild's discovery object
*/
Expand Down Expand Up @@ -1767,8 +1767,8 @@ class Client extends EventEmitter {
* @arg {String} guildID The ID of the guild
* @arg {String} code The template code
* @arg {Object} options The properties to edit
* @arg {String} [options.name] The name of the template
* @arg {String?} [options.description] The description for the template. Set to `null` to remove the description
* @arg {String} [options.name] The name of the template
* @returns {Promise<GuildTemplate>}
*/
editGuildTemplate(guildID, code, options) {
Expand Down Expand Up @@ -1837,8 +1837,8 @@ class Client extends EventEmitter {
* Modify a guild's widget
* @arg {String} guildID The ID of the guild
* @arg {Object} options The widget object to modify (https://discord.com/developers/docs/resources/guild#modify-guild-widget)
* @arg {Boolean} [options.enabled] Whether the guild widget is enabled
* @arg {String?} [options.channelID] The channel ID for the guild widget
* @arg {Boolean} [options.enabled] Whether the guild widget is enabled
* @arg {String?} [options.reason] The reason to be displayed in audit logs
* @returns {Promise<Object>} A guild widget object
*/
Expand All @@ -1855,9 +1855,9 @@ class Client extends EventEmitter {
* @arg {String} messageID The ID of the message
* @arg {String | Array | Object} content A string, array of strings, or object. If an object is passed:
* @arg {Object} [content.allowedMentions] A list of mentions to allow (overrides default)
* @arg {Boolean} [content.allowedMentions.everyone] Whether or not to allow @everyone/@here.
* @arg {Boolean | Array<String>} [content.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow.
* @arg {Boolean | Array<String>} [content.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow.
* @arg {Boolean} [content.allowedMentions.everyone] Whether or not to allow @everyone/@here
* @arg {Boolean | Array<String>} [content.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow
* @arg {Boolean | Array<String>} [content.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow
* @arg {Array<Object>} [content.attachments] An array of attachment objects that will be appended to the message, including new files. Only the provided files will be appended
* @arg {String} [content.attachments[].description] The description of the file
* @arg {String} [content.attachments[].filename] The name of the file. This is not required if you are attaching a new file
Expand Down Expand Up @@ -1985,8 +1985,8 @@ class Client extends EventEmitter {
/**
* Edit properties of the bot user
* @arg {Object} options The properties to edit
* @arg {String} [options.username] The new username
* @arg {String} [options.avatar] The new avatar as a base64 data URI. Note: base64 strings alone are not base64 data URI strings
* @arg {String} [options.username] The new username
* @returns {Promise<ExtendedUser>}
*/
editSelf(options) {
Expand Down Expand Up @@ -2125,9 +2125,9 @@ class Client extends EventEmitter {
* Edit a webhook
* @arg {String} webhookID The ID of the webhook
* @arg {Object} options Webhook options
* @arg {String} [options.name] The new default name
* @arg {String} [options.avatar] The new default avatar as a base64 data URI. Note: base64 strings alone are not base64 data URI strings
* @arg {String} [options.channelID] The new channel ID where webhooks should be sent to
* @arg {String} [options.name] The new default name
* @arg {String} [token] The token of the webhook, used instead of the Bot Authorization token
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Promise<Object>} Resolves with a webhook object
Expand All @@ -2148,8 +2148,8 @@ class Client extends EventEmitter {
* @arg {String} messageID The ID of the message
* @arg {Object} options Webhook message edit options
* @arg {Object} [options.allowedMentions] A list of mentions to allow (overrides default)
* @arg {Boolean} [options.allowedMentions.everyone] Whether or not to allow @everyone/@here.
* @arg {Boolean} [options.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to.
* @arg {Boolean} [options.allowedMentions.everyone] Whether or not to allow @everyone/@here
* @arg {Boolean} [options.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to
* @arg {Boolean | Array<String>} [options.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow
* @arg {Boolean | Array<String>} [options.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow
* @arg {Array<Object>} [options.attachments] An array of attachment objects that will be appended to the message, including new files. Only the provided files will be appended
Expand Down Expand Up @@ -2248,9 +2248,9 @@ class Client extends EventEmitter {
* @arg {String} token The token of the webhook
* @arg {Object} options Webhook execution options
* @arg {Object} [options.allowedMentions] A list of mentions to allow (overrides default)
* @arg {Boolean} [options.allowedMentions.everyone] Whether or not to allow @everyone/@here.
* @arg {Boolean | Array<String>} [options.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow.
* @arg {Boolean | Array<String>} [options.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow.
* @arg {Boolean} [options.allowedMentions.everyone] Whether or not to allow @everyone/@here
* @arg {Boolean | Array<String>} [options.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow
* @arg {Boolean | Array<String>} [options.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow
* @arg {Array<Object>} [options.attachments] An array of attachment objects that will be appended to the message, including new files. Only the provided files will be appended
* @arg {String} [options.attachments[].description] The description of the file
* @arg {String} [options.attachments[].filename] The name of the file. This is not required if you are attaching a new file
Expand Down Expand Up @@ -2818,8 +2818,8 @@ class Client extends EventEmitter {
* @arg {String} messageID The ID of the message
* @arg {String} reaction The reaction (Unicode string if Unicode emoji, `emojiName:emojiID` if custom emoji)
* @arg {Object} [options] Options for the request. If this is a number ([DEPRECATED] behavior), it is treated as `options.limit`
* @arg {Number} [options.limit=100] The maximum number of users to get
* @arg {String} [options.after] Get users after this user ID
* @arg {Number} [options.limit=100] The maximum number of users to get
* @arg {String} [before] [DEPRECATED] Get users before this user ID. Discord no longer supports this parameter
* @arg {String} [after] [DEPRECATED] Get users after this user ID
* @returns {Promise<Array<User>>}
Expand Down Expand Up @@ -3289,9 +3289,9 @@ class Client extends EventEmitter {
* @arg {String} channelID The ID of the voice channel
* @arg {Object} [options] VoiceConnection constructor options
* @arg {Object} [options.opusOnly] Skip opus encoder initialization. You should not enable this unless you know what you are doing
* @arg {Object} [options.shared] Whether the VoiceConnection will be part of a SharedStream or not
* @arg {Boolean} [options.selfMute] Whether the bot joins the channel muted or not
* @arg {Boolean} [options.selfDeaf] Whether the bot joins the channel deafened or not
* @arg {Boolean} [options.selfMute] Whether the bot joins the channel muted or not
* @arg {Object} [options.shared] Whether the VoiceConnection will be part of a SharedStream or not
* @returns {Promise<VoiceConnection>} Resolves with a VoiceConnection
*/
joinVoiceChannel(channelID, options = {}) {
Expand Down
62 changes: 31 additions & 31 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,32 @@ module.exports.GuildNSFWLevels = {
AGE_RESTRICTED: 3
};

module.exports.GuildScheduledEventEntityTypes = {
STAGE_INSTANCE: 1,
VOICE: 2,
EXTERNAL: 3
};

module.exports.GuildScheduledEventPrivacyLevel = {
PUBLIC: 1,
GUILD_ONLY: 2
};

module.exports.GuildScheduledEventStatus = {
SCHEDULED: 1,
ACTIVE: 2,
COMPLETED: 3,
CANCELED: 4
};

module.exports.GuildWidgetStyles = {
SHIELD: "shield",
BANNER_1: "banner1",
BANNER_2: "banner2",
BANNER_3: "banner3",
BANNER_4: "banner4"
};

module.exports.ImageFormats = [
"jpg",
"jpeg",
Expand Down Expand Up @@ -282,11 +308,6 @@ module.exports.InviteTargetTypes = {
EMBEDDED_APPLICATION: 2
};

module.exports.MFALevels = {
NONE: 0,
ELEVATED: 1
};

module.exports.MessageActivityFlags = {
INSTANCE: 1 << 0,
JOIN: 1 << 1,
Expand Down Expand Up @@ -344,6 +365,11 @@ module.exports.MessageTypes = {
CONTEXT_MENU_COMMAND: 23
};

module.exports.MFALevels = {
NONE: 0,
ELEVATED: 1
};

module.exports.PermissionOverwriteTypes = {
ROLE: 0,
USER: 1
Expand Down Expand Up @@ -463,24 +489,6 @@ module.exports.PremiumTiers = {
TIER_3: 3
};

module.exports.GuildScheduledEventStatus = {
SCHEDULED: 1,
ACTIVE: 2,
COMPLETED: 3,
CANCELED: 4
};

module.exports.GuildScheduledEventEntityTypes = {
STAGE_INSTANCE: 1,
VOICE: 2,
EXTERNAL: 3
};

module.exports.GuildScheduledEventPrivacyLevel = {
PUBLIC: 1,
GUILD_ONLY: 2
};

module.exports.PremiumTypes = {
NONE: 0,
NITRO_CLASSIC: 1,
Expand Down Expand Up @@ -589,11 +597,3 @@ module.exports.WebhookTypes = {
CHANNEL_FOLLOWER: 2,
APPLICATION: 3
};

module.exports.GuildWidgetStyles = {
SHIELD: "shield",
BANNER_1: "banner1",
BANNER_2: "banner2",
BANNER_3: "banner3",
BANNER_4: "banner4"
};
Loading