mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
refactor(ApplicationCommandManager): use makeURLSearchParams (#8196)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { Collection } = require('@discordjs/collection');
|
const { Collection } = require('@discordjs/collection');
|
||||||
|
const { makeURLSearchParams } = require('@discordjs/rest');
|
||||||
const { Routes } = require('discord-api-types/v10');
|
const { Routes } = require('discord-api-types/v10');
|
||||||
const ApplicationCommandPermissionsManager = require('./ApplicationCommandPermissionsManager');
|
const ApplicationCommandPermissionsManager = require('./ApplicationCommandPermissionsManager');
|
||||||
const CachedManager = require('./CachedManager');
|
const CachedManager = require('./CachedManager');
|
||||||
@@ -111,10 +112,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
headers: {
|
headers: {
|
||||||
'X-Discord-Locale': locale,
|
'X-Discord-Locale': locale,
|
||||||
},
|
},
|
||||||
query:
|
query: makeURLSearchParams({ with_localizations: withLocalizations }),
|
||||||
typeof withLocalizations === 'boolean'
|
|
||||||
? new URLSearchParams({ with_localizations: withLocalizations })
|
|
||||||
: undefined,
|
|
||||||
});
|
});
|
||||||
return data.reduce((coll, command) => coll.set(command.id, this._add(command, cache, guildId)), new Collection());
|
return data.reduce((coll, command) => coll.set(command.id, this._add(command, cache, guildId)), new Collection());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user