New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discord.js

Package Overview
Dependencies
Maintainers
0
Versions
1788
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord.js - npm Package Compare versions

Comparing version 15.0.0-dev.1737763893-2cbf41800 to 15.0.0-dev.1737850362-695f59236

12

package.json
{
"$schema": "https://json.schemastore.org/package.json",
"name": "discord.js",
"version": "15.0.0-dev.1737763893-2cbf41800",
"version": "15.0.0-dev.1737850362-695f59236",
"description": "A powerful library for interacting with the Discord API",

@@ -64,6 +64,6 @@ "main": "./src/index.js",

"@discordjs/collection": "^2.1.1",
"@discordjs/rest": "^2.4.0",
"@discordjs/util": "^1.1.1",
"@discordjs/formatters": "^0.5.0",
"@discordjs/util": "^1.1.1",
"@discordjs/ws": "^2.0.0",
"@discordjs/rest": "^2.4.0"
"@discordjs/ws": "^2.0.0"
},

@@ -86,4 +86,4 @@ "devDependencies": {

"@discordjs/api-extractor": "^7.38.1",
"@discordjs/scripts": "^0.1.0",
"@discordjs/docgen": "^0.12.1"
"@discordjs/docgen": "^0.12.1",
"@discordjs/scripts": "^0.1.0"
},

@@ -90,0 +90,0 @@ "engines": {

@@ -84,2 +84,3 @@ 'use strict';

* @typedef {BaseFetchOptions} FetchApplicationCommandOptions
* @property {Snowflake} [id] The command's id to fetch
* @property {Snowflake} [guildId] The guild's id to fetch commands for, for when the guild is not cached

@@ -92,4 +93,3 @@ * @property {Locale} [locale] The locale to use when fetching this command

* Obtains one or multiple application commands from Discord, or the cache if it's already available.
* @param {Snowflake|FetchApplicationCommandOptions} [id] Options for fetching application command(s)
* @param {FetchApplicationCommandOptions} [options] Additional options for this fetch
* @param {Snowflake|FetchApplicationCommandOptions} [options] Options for fetching application command(s)
* @returns {Promise<ApplicationCommand|Collection<Snowflake, ApplicationCommand>>}

@@ -103,18 +103,39 @@ * @example

* // Fetch all commands
* client.application.commands.fetch()
* .then(commands => console.log(`Fetched ${commands.size} commands`))
* .catch(console.error);
* @example
* // Fetch all commands in a guild
* guild.commands.fetch()
* .then(commands => console.log(`Fetched ${commands.size} commands`))
* .catch(console.error);
* @example
* // Fetch a single command without checking cache
* guild.commands.fetch({ id: '123456789012345678', force: true })
* .then(command => console.log(`Fetched command ${command.name}`))
* .catch(console.error)
*/
async fetch(id, { guildId, cache = true, force = false, locale, withLocalizations } = {}) {
if (typeof id === 'object') {
({ guildId, cache = true, locale, withLocalizations } = id);
} else if (id) {
if (!force) {
const existing = this.cache.get(id);
if (existing) return existing;
}
const command = await this.client.rest.get(this.commandPath({ id, guildId }));
return this._add(command, cache);
async fetch(options) {
if (!options) return this._fetchMany();
if (typeof options === 'string') return this._fetchSingle({ id: options });
const { cache, force, guildId, id, locale, withLocalizations } = options;
if (id) return this._fetchSingle({ cache, force, guildId, id });
return this._fetchMany({ cache, guildId, locale, withLocalizations });
}
async _fetchSingle({ cache, force = false, guildId, id }) {
if (!force) {
const existing = this.cache.get(id);
if (existing) return existing;
}
const command = await this.client.rest.get(this.commandPath({ id, guildId }));
return this._add(command, cache);
}
async _fetchMany({ cache, guildId, locale, withLocalizations } = {}) {
const data = await this.client.rest.get(this.commandPath({ guildId }), {

@@ -126,2 +147,3 @@ headers: {

});
return data.reduce((coll, command) => coll.set(command.id, this._add(command, cache, guildId)), new Collection());

@@ -128,0 +150,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc