yor.ts / Exports / Guild

Class: Guild

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Guild(client, data): Guild Initializes a new instance of the Constructor class.

Parameters

NameTypeDescription
clientYorClientThe client object.
dataAPIGuildThe APIGuild data.

Returns

Guild

Overrides

Base.constructor

Defined in

src/structures/Guild.ts:46

Properties

client

client: YorClient

Inherited from

Base.client

Defined in

src/structures/Base.ts:4

emojis

emojis: Emoji[]

Defined in

src/structures/Guild.ts:35

features

features: GuildFeature[]

Defined in

src/structures/Guild.ts:31

id

id: string

Defined in

src/structures/Guild.ts:30

joinedTimestamp

Optional joinedTimestamp: number

Defined in

src/structures/Guild.ts:33

premiumTier

premiumTier: GuildPremiumTier

Defined in

src/structures/Guild.ts:32

raw

raw: APIGuild

Defined in

src/structures/Guild.ts:38

roles

roles: Role[]

Defined in

src/structures/Guild.ts:34

stickers

stickers: Sticker[]

Defined in

src/structures/Guild.ts:36

Methods

createChannel

createChannel(data): Promise<Channel> Creates a channel with the given data and reason.

Parameters

NameTypeDescription
dataObjectThe data for creating the channel.
data.flags?AddUndefinedToPossiblyUndefinedPropertiesOfInterface<undefined | ChannelFlags>-
data.namestring-
data.nsfw?AddUndefinedToPossiblyUndefinedPropertiesOfInterface<undefined | boolean>Whether the channel is nsfw
data.parent_id?null | string | number-
data.permission_overwrites?APIGuildCreateOverwrite[]-
data.position?AddUndefinedToPossiblyUndefinedPropertiesOfInterface<undefined | number>Sorting position of the channel
data.reason?string-
data.type?GuildText | GuildVoice | GuildCategory | GuildAnnouncement | AnnouncementThread | PublicThread | PrivateThread | GuildStageVoice | GuildForum | GuildMedia-

Returns

Promise<Channel> A promise that resolves when the channel is created.

Defined in

src/structures/Guild.ts:231

createTemplate

createTemplate(name, description?): Promise<APITemplate> Creates a template for the guild.

Parameters

NameTypeDescription
namestringThe name for the template
description?stringThe description for the template

Returns

Promise<APITemplate>

Defined in

src/structures/Guild.ts:133

edit

edit(data): Promise<Guild> Edits the guild with the given data.

Parameters

NameTypeDescription
dataRESTPatchAPIGuildJSONBodyThe data to edit the guild with.

Returns

Promise<Guild> A promise that resolves with the edited guild.

Defined in

src/structures/Guild.ts:220

fetchAuditLogs

fetchAuditLogs(options?): Promise<Omit<APIAuditLog, "users"> & { users: User[] }> Fetches the audit logs for the API.

Parameters

NameTypeDescription
options?RESTGetAPIAuditLogQueryOptional query parameters for the audit log request.

Returns

Promise<Omit<APIAuditLog, "users"> & { users: User[] }> A promise that resolves to the audit logs along with the users associated with the logs.

Defined in

src/structures/Guild.ts:194

fetchOnboarding

fetchOnboarding(): Promise<APIGuildOnboarding> Fetches the onboarding data for the guild.

Returns

Promise<APIGuildOnboarding>
  • The onboarding data for the guild.

Defined in

src/structures/Guild.ts:210

fetchPreview

fetchPreview(): Promise<APIGuildPreview> Obtains a guild preview for this guild from Discord.

Returns

Promise<APIGuildPreview>

Defined in

src/structures/Guild.ts:147

fetchStickers

fetchStickers(): Promise<APISticker[]> Fetches the stickers.

Returns

Promise<APISticker[]> The result of the API call.

Defined in

src/structures/Guild.ts:174

fetchTemplates

fetchTemplates(): Promise<RESTGetAPIGuildTemplatesResult> Fetches the templates for the guild.

Returns

Promise<RESTGetAPIGuildTemplatesResult> The result of the fetch operation.

Defined in

src/structures/Guild.ts:114

fetchVanity

fetchVanity(): Promise<RESTGetAPIGuildVanityUrlResult> Retrieves the vanity URL of the guild.

Returns

Promise<RESTGetAPIGuildVanityUrlResult> The result of the API call

Defined in

src/structures/Guild.ts:156

fetchWebhooks

fetchWebhooks(): Promise<APIWebhook[]> Fetches the webhooks.

Returns

Promise<APIWebhook[]> The webhooks.

Defined in

src/structures/Guild.ts:165

fetchWelcomeScreen

fetchWelcomeScreen(): Promise<APIGuildWelcomeScreen> Fetches the welcome screen for the guild.

Returns

Promise<APIGuildWelcomeScreen> A promise that resolves to the welcome screen for the guild.

Defined in

src/structures/Guild.ts:123

fetchWidget

fetchWidget(): Promise<APIGuildWidget> Fetches the widget for the guild.

Returns

Promise<APIGuildWidget> The guild widget.

Defined in

src/structures/Guild.ts:184

getIntegrations

getIntegrations(): Promise<RESTGetAPIGuildIntegrationsResult> Retrieves the integrations for the guild.

Returns

Promise<RESTGetAPIGuildIntegrationsResult> A promise that resolves with the result of the API call.

Defined in

src/structures/Guild.ts:105

joinedAt

joinedAt(): undefined | Date Returns the date when the user joined.

Returns

undefined | Date The date when the user joined, or undefined if no joined timestamp is available.

Defined in

src/structures/Guild.ts:74

maximumBitrate

maximumBitrate(): number Calculates and returns the maximum bitrate for audio streaming based on the guild’s premium tier and features.

Returns

number The maximum bitrate in bits per second.

Defined in

src/structures/Guild.ts:83