Guild

Guild

Represents a Discord guild.

Constructor

new Guild(client, data, optionsnullable)

Description:
  • Creates the structure for a guild.

Source:
See:
Parameters:
Name Type Attributes Description
client Client

The client instance.

data Object

Raw guild data.

options Object <nullable>

The additional options for this structure.

Properties
Name Type Attributes Description
nocache Boolean <nullable>

Whether this guild should be cached or not.

Members

(readonly) _cacheOptions :GuildCacheOptions

Description:
  • The cache options for this guild.

Source:

The cache options for this guild.

Type:

(readonly) channels :GuildChannelsManager

Description:
  • The channels in the guild.

Source:

The channels in the guild.

Type:

(readonly) defaultMessageNotifications :String

Description:
  • Default notification setting.

Source:
See:

Default notification setting.

Type:
  • String

(readonly, nullable) description :String

Description:
  • The description of the guild.

Source:

The description of the guild.

Type:
  • String

(readonly, nullable) displayIconURL :String

Description:
  • The icon URL of the guild.

Source:

The icon URL of the guild.

Type:
  • String

(readonly) emojis :GuildEmojisManager

Description:
  • The emojis in the guild.

Source:

The emojis in the guild.

Type:

(readonly) explicitContentFilter :String

Description:
  • Explicit content filter level.

Source:
See:

Explicit content filter level.

Type:
  • String

(readonly) id :String

Description:
  • The id of the guild.

Source:

The id of the guild.

Type:
  • String

(readonly) invites :GuildInviteManager

Description:
  • The invites in the guild.

Source:

The invites in the guild.

Type:

(readonly) joinedAt :Number

Description:
  • The id of the guild owner.

Source:

The id of the guild owner.

Type:
  • Number

(readonly) memberCount :Number

Description:
  • The member count of the guild.

Source:

The member count of the guild.

Type:
  • Number

(readonly) members :GuildMemberManager

Description:
  • The members in the guild.

Source:

The members in the guild.

Type:

(readonly) mfaLevel :String

Description:
  • Server MFA level.

Source:
See:

Server MFA level.

Type:
  • String

(readonly) name :String

Description:
  • The name of the guild.

Source:

The name of the guild.

Type:
  • String

(readonly) nsfwLevel :String

Description:
  • Server NSFW level.

Source:
See:

Server NSFW level.

Type:
  • String

(readonly) owner :Member

Description:
  • The owner of the guild.

Source:

The owner of the guild.

Type:

(readonly) ownerId :String

Description:
  • The icon hash of the guild.

Source:

The icon hash of the guild.

Type:
  • String

(readonly) preferredLocale :String

Description:
  • The preferred locale of the guild.

Source:

The preferred locale of the guild.

Type:
  • String

(readonly) premiumProgressBarEnabled :Boolean

Description:
  • Whether the guild has the boost progress bar enabled.

Source:

Whether the guild has the boost progress bar enabled.

Type:
  • Boolean

(readonly) premiumSubscriptionCount :Number

Description:
  • The premium subscription count of the guild.

Source:

The premium subscription count of the guild.

Type:
  • Number

(readonly) premiumTier :Number

Description:
  • Server boost level.

Source:
See:

Server boost level.

Type:
  • Number

(readonly) rawDefaultMessageNotifications :Number

Description:
  • Default notification setting.

Source:
See:

Default notification setting.

Type:
  • Number

(readonly) rawExplicitContentFilter :Number

Description:
  • Explicit content filter level.

Source:
See:

Explicit content filter level.

Type:
  • Number

(readonly) rawMfaLevel :Number

Description:
  • Server MFA level.

Source:
See:

Server MFA level.

Type:
  • Number

(readonly) rawNsfwLevel :Number

Description:
  • Server NSFW level.

Source:
See:

Server NSFW level.

Type:
  • Number

(readonly) rawSystemChannelFlags :Number

Description:
  • Raw system channel flags.

Source:
See:

Raw system channel flags.

Type:
  • Number

(readonly) rawVerificationLevel :Number

Description:
  • Server verification level.

Source:
See:

Server verification level.

Type:
  • Number

(readonly) roles :GuildRoleManager

Description:
  • The roles in the guild.

Source:

The roles in the guild.

Type:

(readonly, nullable) rulesChannel :TextChannel

Description:
  • The rules channel of the guild.

Source:

The rules channel of the guild.

Type:

(readonly, nullable) rulesChannelId :String

Description:
  • The rules channel id of the guild.

Source:

The rules channel id of the guild.

Type:
  • String

(readonly) scheduledEvents :GuildScheduledEventManager

Description:
  • The scheduled events in the guild.

Source:

The scheduled events in the guild.

Type:

(readonly, nullable) systemChannel :TextChannel

Description:
  • The system channel of the guild.

Source:

The system channel of the guild.

Type:

(readonly) systemChannelFlags :Array.<String>

Description:
  • System channel flags.

Source:
See:

System channel flags.

Type:
  • Array.<String>

(readonly, nullable) systemChannelId :String

Description:
  • The system channel id of the guild.

Source:

The system channel id of the guild.

Type:
  • String

(readonly) unavailable :Boolean

Description:
  • Whether the guild is unavailable.

Source:

Whether the guild is unavailable.

Type:
  • Boolean

(readonly) verificationLevel :String

Description:
  • Server verification level.

Source:
See:

Server verification level.

Type:
  • String

(readonly) voiceStates :GuildVoiceStatesManager

Description:
  • The voice states in the guild.

Source:

The voice states in the guild.

Type:

Methods

(async, static) createWebhook(client, channelId, options) → {Promise.<Object>}

Description:
  • Creates a webhook in the given channel with the name "Gluon".

Source:
Parameters:
Name Type Description
client Client

The client instance.

channelId String

The id of the channel to create the webhook in.

options Object

The options for creating the webhook.

Properties
Name Type Description
name String

The name of the webhook.

Throws:
TypeError
Returns:
Type
Promise.<Object>

(async, static) deleteWebhook(client, webhookId) → {Promise.<void>}

Description:
  • Deletes a webhook.

Source:
Parameters:
Name Type Description
client Client

The client instance.

webhookId String

The id of the webhook to delete.

Throws:
TypeError
Returns:
Type
Promise.<void>

(async, static) fetchWebhook(client, webhookId) → {Promise.<Object>}

Description:
  • Fetches a webhook by the webhook's id.

Source:
Parameters:
Name Type Description
client Client

The client instance.

webhookId String

The id of the webhook to fetch.

Throws:
TypeError
Returns:
Type
Promise.<Object>

(static) getIcon(id, hashnullable) → {String}

Description:
  • Returns the icon URL of the guild.

Source:
Parameters:
Name Type Attributes Description
id String

The id of the guild.

hash String <nullable>

The hash of the guild icon.

Returns:
Type
String

(async, static) modifyWebhook(client, webhookId, options) → {Promise.<Object>}

Description:
  • Modified a webhook with the given webhook id.

Source:
Parameters:
Name Type Description
client Client

The client instance.

webhookId String

The id of the webhook to modify.

options Object

The options to modify the webhook with.

Properties
Name Type Description
channelId String

The id of the channel the webhook belongs to.

Throws:
TypeError
Returns:
Type
Promise.<Object>

(async, static) postWebhook(client, referenceData, contentnullable, optionsnullable) → {Promise.<void>}

Description:
  • Posts a webhook with the provided webhook id and token.

Source:
Parameters:
Name Type Attributes Description
client Client

The client instance.

referenceData Object

An object with the webhook id and token.

content String <nullable>

The message to send with the webhook.

options Object <nullable>

Embeds, components and files to attach to the webhook.

Throws:
TypeError
Returns:
Type
Promise.<void>

(static) shouldCache(gluonCacheOptions) → {Boolean}

Description:
  • Determines whether the emoji should be cached.

Source:
Parameters:
Name Type Description
gluonCacheOptions GluonCacheOptions

The cache options for the client.

Returns:
Type
Boolean

_decrementMemberCount()

Description:
  • Decreases the member count of the guild.

Source:

_incrementMemberCount()

Description:
  • Increases the member count of the guild.

Source:

_intervalCallback()

Source:

(async) ban(user_id, optionsnullable) → {Promise.<?void>}

Description:
  • Bans a user with the given id from the guild.

Source:
Parameters:
Name Type Attributes Description
user_id String

The id of the user to ban.

options Object <nullable>

Ban options.

Throws:
Error | TypeError
Returns:
Type
Promise.<?void>

calculateMemberCacheCount() → {Number}

Description:
  • Calculates the number of members that should be cached for this guild.

Source:
Returns:
Type
Number

calculateMessageCacheCount() → {Number}

Description:
  • Calculates the number of messages that should be cached per channel for this guild.

Source:
Returns:
Type
Number

(async) fetchAuditLogs(optionsnullable) → {Promise.<?Array.<AuditLog>>}

Description:
  • Fetches audit logs.

Source:
Parameters:
Name Type Attributes Description
options Object <nullable>

Audit log fetch options.

Throws:
Error | TypeError
Returns:
Type
Promise.<?Array.<AuditLog>>

(async) fetchBan(user_id) → {Promise.<?Object>}

Description:
  • Fetches the ban for the provided user id.

Source:
Parameters:
Name Type Description
user_id String

The id of the user to fetch the ban of.

Throws:
Error | TypeError
Returns:
Type
Promise.<?Object>

(async) fetchChannels() → {Promise.<Array.<(TextChannel|VoiceState)>>}

Description:
  • Fetches all the guild channels.

Source:
Throws:
Error
Returns:
Type
Promise.<Array.<(TextChannel|VoiceState)>>

(async) fetchInvites() → {Promise.<?Array.<Object>>}

Description:
  • Fetches the guild invites.

Source:
Throws:
Error
Returns:
Type
Promise.<?Array.<Object>>

(async) kick(user_id, optionsnullable) → {Promise.<?void>}

Description:
  • Kicks a user with the given id from the guild.

Source:
Parameters:
Name Type Attributes Description
user_id String

The id of the user to kick.

options Object <nullable>

Kick options.

Throws:
Error | TypeError
Returns:
Type
Promise.<?void>

(async) leave() → {Promise.<?void>}

Description:
  • Leaves the guild.

Source:
Throws:
Error
Returns:
Type
Promise.<?void>

(async) me() → {Promise.<Member>}

Description:
  • Returns the client member for this guild.

Source:
Throws:
Error
Returns:
Type
Promise.<Member>

(async) removeMemberRole(user_id, role_id, optionsnullable) → {Promise.<?void>}

Description:
  • Removes the given role from the given member.

Source:
Parameters:
Name Type Attributes Description
user_id String

The id of the user.

role_id String

The id of the role.

options Object <nullable>

Remove role options.

Throws:
Error | TypeError
Returns:
Type
Promise.<?void>

toJSON(format) → {Object}

Description:
  • Returns the JSON representation of this structure.

Source:
Parameters:
Name Type Description
format Number

The format to return the data in.

Returns:
Type
Object

toString()

Source:

(async) unban(user_id, optionsnullable) → {Promise.<?void>}

Description:
  • Unbans a user with the given id from the guild.

Source:
Parameters:
Name Type Attributes Description
user_id String

The id of the user to unban.

options Object <nullable>

Unban options.

Throws:
Error | TypeError
Returns:
Type
Promise.<?void>