mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
feat(Guild): add includeApplications option for fetchIntegrations (#4762)
This commit is contained in:
@@ -698,6 +698,8 @@ class Guild extends Base {
|
||||
/**
|
||||
* Fetches a collection of integrations to this guild.
|
||||
* Resolves with a collection mapping integrations by their ids.
|
||||
* @param {Object} [options] Options for fetching integrations
|
||||
* @param {boolean} [options.includeApplications] Whether to include bot and Oauth2 webhook integrations
|
||||
* @returns {Promise<Collection<string, Integration>>}
|
||||
* @example
|
||||
* // Fetch integrations
|
||||
@@ -705,10 +707,14 @@ class Guild extends Base {
|
||||
* .then(integrations => console.log(`Fetched ${integrations.size} integrations`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
fetchIntegrations() {
|
||||
fetchIntegrations({ includeApplications = false } = {}) {
|
||||
return this.client.api
|
||||
.guilds(this.id)
|
||||
.integrations.get()
|
||||
.integrations.get({
|
||||
query: {
|
||||
include_applications: includeApplications,
|
||||
},
|
||||
})
|
||||
.then(data =>
|
||||
data.reduce(
|
||||
(collection, integration) => collection.set(integration.id, new Integration(this.client, integration, this)),
|
||||
|
||||
Reference in New Issue
Block a user