Guild
Type Parameters
Type Parameter | Default type |
---|---|
IsPartial extends boolean | false |
Constructors
Constructor
new Guild<
IsPartial
>(client
,rawDataOrId
):Guild
<IsPartial
>
Parameters
Parameter | Type |
---|---|
client | Client |
rawDataOrId | IsPartial extends true ? string : APIGuild |
Returns
Guild
<IsPartial
>
Overrides
Base.constructor
Properties
Property | Modifier | Type | Default value | Description | Inherited from |
---|---|---|---|---|---|
client | public | Client | undefined | - | Base.client |
id | readonly | string | undefined | The ID of the guild | - |
rawData | protected | null | APIGuild | null | - | - |
Accessors
afkChannelId
Get Signature
get afkChannelId():
IfPartial
<IsPartial
,null
|string
>
ID of afk channel
Returns
IfPartial
<IsPartial
, null
| string
>
afkTimeout
Get Signature
get afkTimeout():
IfPartial
<IsPartial
,60
|300
|900
|1800
|3600
>
afk timeout in seconds, can be set to: 60
, 300
, 900
, 1800
, 3600
Returns
IfPartial
<IsPartial
, 60
| 300
| 900
| 1800
| 3600
>
applicationId
Get Signature
get applicationId():
IfPartial
<IsPartial
,null
|string
>
Application id of the guild creator if it is bot-created
Returns
IfPartial
<IsPartial
, null
| string
>
approximateMemberCount
Get Signature
get approximateMemberCount():
IfPartial
<IsPartial
,number
>
Approximate number of members in this guild
Returns
IfPartial
<IsPartial
, number
>
approximatePresenceCount
Get Signature
get approximatePresenceCount():
IfPartial
<IsPartial
,number
>
Approximate number of non-offline members in this guild
Returns
IfPartial
<IsPartial
, number
>
banner
Get Signature
get banner():
IfPartial
<IsPartial
,null
|string
>
Banner hash You can use Guild.bannerUrl to get the URL of the banner.
Returns
IfPartial
<IsPartial
, null
| string
>
bannerUrl
Get Signature
get bannerUrl():
IfPartial
<IsPartial
,null
|string
>
Get the URL of the guild's banner
Returns
IfPartial
<IsPartial
, null
| string
>
defaultMessageNotifications
Get Signature
get defaultMessageNotifications():
IfPartial
<IsPartial
,GuildDefaultMessageNotifications
>
Default message notifications level
Returns
IfPartial
<IsPartial
, GuildDefaultMessageNotifications
>
description
Get Signature
get description():
IfPartial
<IsPartial
,null
|string
>
The description of the guild.
Returns
IfPartial
<IsPartial
, null
| string
>
discoverySplash
Get Signature
get discoverySplash():
IfPartial
<IsPartial
,null
|string
>
The discovery splash hash of the guild. You can use Guild.discoverySplashUrl to get the URL of the discovery splash.
Returns
IfPartial
<IsPartial
, null
| string
>
discoverySplashUrl
Get Signature
get discoverySplashUrl():
IfPartial
<IsPartial
,null
|string
>
Get the URL of the guild's discovery splash
Returns
IfPartial
<IsPartial
, null
| string
>
emojis
Get Signature
get emojis():
IfPartial
<IsPartial
,APIEmoji
[]>
Custom guild emojis
Returns
IfPartial
<IsPartial
, APIEmoji
[]>
explicitContentFilter
Get Signature
get explicitContentFilter():
IfPartial
<IsPartial
,GuildExplicitContentFilter
>
Explicit content filter level
Returns
IfPartial
<IsPartial
, GuildExplicitContentFilter
>
features
Get Signature
get features():
IfPartial
<IsPartial
,GuildFeature
[]>
Enabled guild features
Returns
IfPartial
<IsPartial
, GuildFeature
[]>
hubType
Get Signature
get hubType():
IfPartial
<IsPartial
,null
|GuildHubType
>
The type of Student Hub the guild is
Returns
IfPartial
<IsPartial
, null
| GuildHubType
>
icon
Get Signature
get icon():
IfPartial
<IsPartial
,null
|string
>
The icon hash of the guild. You can use Guild.iconUrl to get the URL of the icon.
Returns
IfPartial
<IsPartial
, null
| string
>
iconUrl
Get Signature
get iconUrl():
IfPartial
<IsPartial
,null
|string
>
Get the URL of the guild's icon
Returns
IfPartial
<IsPartial
, null
| string
>
incidentsData
Get Signature
get incidentsData():
IfPartial
<IsPartial
,null
|APIIncidentsData
>
The incidents data for this guild
Returns
IfPartial
<IsPartial
, null
| APIIncidentsData
>
maxMembers
Get Signature
get maxMembers():
IfPartial
<IsPartial
,number
>
The maximum number of members for the guild
Returns
IfPartial
<IsPartial
, number
>
maxPresences
Get Signature
get maxPresences():
IfPartial
<IsPartial
,null
|number
>
The maximum number of presences for the guild (null
is always returned, apart from the largest of guilds)
Returns
IfPartial
<IsPartial
, null
| number
>
maxStageVideoChannelUsers
Get Signature
get maxStageVideoChannelUsers():
IfPartial
<IsPartial
,number
>
The maximum amount of users in a stage video channel
Returns
IfPartial
<IsPartial
, number
>
maxVideoChannelUsers
Get Signature
get maxVideoChannelUsers():
IfPartial
<IsPartial
,number
>
The maximum amount of users in a video channel
Returns
IfPartial
<IsPartial
, number
>
mfaLevel
Get Signature
get mfaLevel():
IfPartial
<IsPartial
,GuildMFALevel
>
Required MFA level for the guild
Returns
IfPartial
<IsPartial
, GuildMFALevel
>
name
Get Signature
get name():
IfPartial
<IsPartial
,string
>
The name of the guild.
Returns
IfPartial
<IsPartial
, string
>
nsfwLevel
Get Signature
get nsfwLevel():
IfPartial
<IsPartial
,GuildNSFWLevel
>
The nsfw level of the guild
Returns
IfPartial
<IsPartial
, GuildNSFWLevel
>
owner
Get Signature
get owner():
IfPartial
<IsPartial
,boolean
>
Whether the user is the owner of the guild
Returns
IfPartial
<IsPartial
, boolean
>
ownerId
Get Signature
get ownerId():
IfPartial
<IsPartial
,string
>
The ID of the owner of the guild.
Returns
IfPartial
<IsPartial
, string
>
partial
Get Signature
get partial():
IfPartial
<IsPartial
,false
,true
>
Whether the guild is a partial guild (meaning it does not have all the data). If this is true, you should use Guild.fetch to get the full data of the guild.
Returns
IfPartial
<IsPartial
, false
, true
>
permissions
Get Signature
get permissions():
IfPartial
<IsPartial
,bigint
>
Total permissions for the user in the guild (excludes overrides)
Returns
IfPartial
<IsPartial
, bigint
>
preferredLocale
Get Signature
get preferredLocale():
IfPartial
<IsPartial
,string
>
The preferred locale of the guild.
Returns
IfPartial
<IsPartial
, string
>
premiumProgressBarEnabled
Get Signature
get premiumProgressBarEnabled():
IfPartial
<IsPartial
,boolean
>
Whether the guild has the boost progress bar enabled
Returns
IfPartial
<IsPartial
, boolean
>
premiumSubscriptionCount
Get Signature
get premiumSubscriptionCount():
IfPartial
<IsPartial
,number
>
The number of boosts this guild currently has
Returns
IfPartial
<IsPartial
, number
>
premiumTier
Get Signature
get premiumTier():
IfPartial
<IsPartial
,GuildPremiumTier
>
Premium tier (Server Boost level)
Returns
IfPartial
<IsPartial
, GuildPremiumTier
>
publicUpdatesChannelId
Get Signature
get publicUpdatesChannelId():
IfPartial
<IsPartial
,null
|string
>
The id of the channel where admins and moderators of Community guilds receive notices from Discord
Returns
IfPartial
<IsPartial
, null
| string
>
roles
Get Signature
Get all roles in the guild
Returns
IfPartial
<IsPartial
, Role
<false
>[]>
rulesChannelId
Get Signature
get rulesChannelId():
IfPartial
<IsPartial
,null
|string
>
The id of the channel where Community guilds can display rules and/or guidelines
Returns
IfPartial
<IsPartial
, null
| string
>
safetyAlertsChannelId
Get Signature
get safetyAlertsChannelId():
IfPartial
<IsPartial
,null
|string
>
The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
Returns
IfPartial
<IsPartial
, null
| string
>
splash
Get Signature
get splash():
IfPartial
<IsPartial
,null
|string
>
The splash hash of the guild. You can use Guild.splashUrl to get the URL of the splash.
Returns
IfPartial
<IsPartial
, null
| string
>
splashUrl
Get Signature
get splashUrl():
IfPartial
<IsPartial
,null
|string
>
Get the URL of the guild's splash
Returns
IfPartial
<IsPartial
, null
| string
>
stickers
Get Signature
get stickers():
IfPartial
<IsPartial
,APISticker
[]>
Custom guild stickers
Returns
IfPartial
<IsPartial
, APISticker
[]>
systemChannelFlags
Get Signature
get systemChannelFlags():
IfPartial
<IsPartial
,GuildSystemChannelFlags
>
System channel flags
Returns
IfPartial
<IsPartial
, GuildSystemChannelFlags
>
systemChannelId
Get Signature
get systemChannelId():
IfPartial
<IsPartial
,null
|string
>
The id of the channel where guild notices such as welcome messages and boost events are posted
Returns
IfPartial
<IsPartial
, null
| string
>
vanityUrlCode
Get Signature
get vanityUrlCode():
IfPartial
<IsPartial
,null
|string
>
The vanity url code for the guild
Returns
IfPartial
<IsPartial
, null
| string
>
verificationLevel
Get Signature
get verificationLevel():
IfPartial
<IsPartial
,GuildVerificationLevel
>
Verification level required for the guild
Returns
IfPartial
<IsPartial
, GuildVerificationLevel
>
welcomeScreen
Get Signature
get welcomeScreen():
IfPartial
<IsPartial
,undefined
|APIGuildWelcomeScreen
>
The welcome screen of a Community guild, shown to new members
Returns
IfPartial
<IsPartial
, undefined
| APIGuildWelcomeScreen
>
widgetChannelId
Get Signature
get widgetChannelId():
IfPartial
<IsPartial
,null
|string
>
The channel id that the widget will generate an invite to, or null
if set to no invite
Returns
IfPartial
<IsPartial
, null
| string
>
widgetEnabled
Get Signature
get widgetEnabled():
IfPartial
<IsPartial
,boolean
>
Whether the guild widget is enabled
Returns
IfPartial
<IsPartial
, boolean
>
Methods
createRole()
Create a role in the guild
Parameters
Parameter | Type |
---|---|
data | RESTPostAPIGuildRoleJSONBody |
Returns
fetch()
fetch():
Promise
<Guild
<false
>>
Fetch updated data for this guild. If the guild is partial, this will fetch all the data for the guild and populate the fields. If the guild is not partial, all fields will be updated with new values from Discord.
Returns
Promise
<Guild
<false
>>
A Promise that resolves to a non-partial Guild
fetchChannel()
fetchChannel(
channelId
):Promise
<null
|DmChannel
<false
> |GroupDmChannel
<false
> |GuildTextChannel
<false
> |GuildVoiceChannel
<false
> |GuildCategoryChannel
<false
> |GuildAnnouncementChannel
<false
> |GuildThreadChannel
<ThreadChannelType
,false
> |GuildStageChannel
<false
> |GuildForumChannel
<false
> |GuildMediaChannel
>
Fetch a channel from the guild by ID
Parameters
Parameter | Type |
---|---|
channelId | string |
Returns
Promise
<null
| DmChannel
<false
> | GroupDmChannel
<false
> | GuildTextChannel
<false
> | GuildVoiceChannel
<false
> | GuildCategoryChannel
<false
> | GuildAnnouncementChannel
<false
> | GuildThreadChannel
<ThreadChannelType
, false
> | GuildStageChannel
<false
> | GuildForumChannel
<false
> | GuildMediaChannel
>
fetchChannels()
fetchChannels():
Promise
<(null
|DmChannel
<false
> |GroupDmChannel
<false
> |GuildTextChannel
<false
> |GuildVoiceChannel
<false
> |GuildCategoryChannel
<false
> |GuildAnnouncementChannel
<false
> |GuildThreadChannel
<ThreadChannelType
,false
> |GuildStageChannel
<false
> |GuildForumChannel
<false
> |GuildMediaChannel
)[]>
Fetch all channels in the guild
Returns
Promise
<(null
| DmChannel
<false
> | GroupDmChannel
<false
> | GuildTextChannel
<false
> | GuildVoiceChannel
<false
> | GuildCategoryChannel
<false
> | GuildAnnouncementChannel
<false
> | GuildThreadChannel
<ThreadChannelType
, false
> | GuildStageChannel
<false
> | GuildForumChannel
<false
> | GuildMediaChannel
)[]>
A Promise that resolves to an array of channel objects
fetchMember()
fetchMember(
memberId
):Promise
<null
|GuildMember
<false
,true
>>
Get a member in the guild by ID
Parameters
Parameter | Type | Description |
---|---|---|
memberId | string | The ID of the member to fetch |
Returns
Promise
<null
| GuildMember
<false
, true
>>
A Promise that resolves to a GuildMember or null if not found
fetchMembers()
fetchMembers(
limit
):Promise
<GuildMember
<false
,IsPartial
>[]>
Experimental
Fetch all members in the guild
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
limit | number | "all" | 100 | The maximum number of members to fetch (max 1000, default 100, set to "all" to fetch all members) |
Returns
Promise
<GuildMember
<false
, IsPartial
>[]>
A Promise that resolves to an array of GuildMember objects
fetchRole()
Fetch a role from the guild by ID
Parameters
Parameter | Type |
---|---|
roleId | string |
Returns
fetchRoles()
Fetch all roles in the guild
Returns
A Promise that resolves to an array of Role objects
leave()
leave():
Promise
<void
>
Leave the guild
Returns
Promise
<void
>