Class: GuildManager

GuildManager

Manages API methods for Guilds and stores their cache.

Constructor

new GuildManager()

Source:

Extends

Members

cache :Collection.<Snowflake, Guild>

The cache of this Manager
Type:
Overrides:
Source:

cacheType :Collection

The type of Collection of the Manager
Type:
  • Collection
Overrides:
Source:

(readonly) client :Client

The client that instantiated this Manager
Type:
Overrides:
Source:

(private, readonly) holds :function

The data structure belonging to this manager
Type:
  • function
Overrides:
Source:

Methods

create(name, optionsopt) → {Promise.<Guild>}

Creates a guild. This is only available to bots in fewer than 10 guilds.
Parameters:
Name Type Attributes Description
name string The name of the guild
options Object <optional>
Options for the creating
Properties
Name Type Attributes Default Description
channels Array.<PartialChannelData> <optional>
The channels for this guild
defaultMessageNotifications DefaultMessageNotifications <optional>
The default message notifications for the guild
explicitContentFilter ExplicitContentFilterLevel <optional>
The explicit content filter level for the guild
icon BufferResolvable | Base64Resolvable <optional>
null The icon for the guild
region string <optional>
The region for the server, defaults to the closest one available
roles Array.<PartialRoleData> <optional>
The roles for this guild, the first element of this array is used to change properties of the guild's everyone role.
verificationLevel VerificationLevel <optional>
The verification level for the guild
Source:
Returns:
The guild that was created
Type
Promise.<Guild>

fetch(id, cacheopt, forceopt) → {Promise.<Guild>}

Obtains a guild from Discord, or the guild cache if it's already available.
Parameters:
Name Type Attributes Default Description
id Snowflake ID of the guild
cache boolean <optional>
true Whether to cache the new guild object if it isn't already
force boolean <optional>
false Whether to skip the cache check and request the API
Source:
Returns:
Type
Promise.<Guild>
Example
// Fetch a guild by its id
client.guilds.fetch('222078108977594368')
  .then(guild => console.log(guild.name))
  .catch(console.error);

resolve(guild) → {Guild}

Resolves a GuildResolvable to a Guild object.
Parameters:
Name Type Description
guild GuildResolvable The guild resolvable to identify
Overrides:
Source:
Returns:
Type
Guild

resolveID(guild) → {Snowflake}

Resolves a GuildResolvable to a Guild ID string.
Parameters:
Name Type Description
guild GuildResolvable The guild resolvable to identify
Overrides:
Source:
Returns:
Type
Snowflake