Carbon
CoreClasses

Guild

Extends

  • Base

Type Parameters

Type ParameterDefault type
IsPartial extends booleanfalse

Constructors

new Guild()

new Guild<IsPartial>(client, rawDataOrId): Guild<IsPartial>

Parameters

ParameterType
clientClient
rawDataOrIdIsPartial extends true ? string : APIGuild

Returns

Guild<IsPartial>

Overrides

Base.constructor

Properties

PropertyModifierTypeDescriptionInherited from
clientpublicClient-Base.client
idreadonlystringThe ID of the guild-

Accessors

description

get description(): IfPartial<IsPartial, null | string>

The description of the guild.

Returns

IfPartial<IsPartial, null | string>


icon

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 iconUrl(): IfPartial<IsPartial, null | string>

Get the URL of the guild's icon

Returns

IfPartial<IsPartial, null | string>


name

get name(): IfPartial<IsPartial, string>

The name of the guild.

Returns

IfPartial<IsPartial, string>


ownerId

get ownerId(): IfPartial<IsPartial, string>

The ID of the owner of the guild.

Returns

IfPartial<IsPartial, string>


partial

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>


roles

get roles(): IfPartial<IsPartial, Role<false>[]>

Get all roles in the guild

Returns

IfPartial<IsPartial, Role<false>[]>


splash

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 splashUrl(): IfPartial<IsPartial, null | string>

Get the URL of the guild's splash

Returns

IfPartial<IsPartial, null | string>

Methods

createRole()

createRole(data): Promise<Role<false>>

Create a role in the guild

Parameters

ParameterType
dataRESTPostAPIGuildRoleJSONBody

Returns

Promise<Role<false>>


fetch()

fetch(): Promise<void>

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<void>


fetchChannel()

fetchChannel(channelId): Promise<null | GuildCategoryChannel<false> | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>

Fetch a channel from the guild by ID

Parameters

ParameterType
channelIdstring

Returns

Promise<null | GuildCategoryChannel<false> | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>


fetchMember()

fetchMember(memberId): Promise<GuildMember<false, IsPartial>>

Get a member in the guild by ID

Parameters

ParameterType
memberIdstring

Returns

Promise<GuildMember<false, IsPartial>>


leave()

leave(): Promise<unknown>

Leave the guild

Returns

Promise<unknown>

On this page

Edit on GitHub