Link Search Menu Expand Document (external link)

Birb / GuildsManager

Class: GuildsManager

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new GuildsManager(client)

Parameters

Name Type
client Birb

Overrides

Manager.constructor

Defined in

src/classes/managers/GuildsManager.ts:23

Properties

cache

cache: Cache<string, Guild>

The cache for guilds. This cache includes guilds that are available and unavailable. For a guild to be stored in this cache, the client must see it available at least once.

Overrides

Manager.cache

Defined in

src/classes/managers/GuildsManager.ts:15


client

client: Birb

The Birb client.

Inherited from

Manager.client

Defined in

src/classes/managers/Manager.ts:8


unavailableCache

unavailableCache: Cache<string, GuildPartial>

The cache for unavailable guilds. Guilds are pushed here when they are unavailable and the client has never seen them available. This allows you to keep track of these guilds, but they won’t unintentionally get in the way.

Defined in

src/classes/managers/GuildsManager.ts:21

Methods

fetch

fetch(target): Promise<undefined | Guild>

Fetch a guild from the cache, or the API if it is not cached.

Parameters

Name Type Description
target string | GuildPartial | Guild The target guild.

Returns

Promise<undefined | Guild>

Defined in

src/classes/managers/GuildsManager.ts:56


resolve

resolve(target): undefined | GuildPartial | Guild

Resolves a guild in the cache from an ID.

Note: This method will not fetch the guild from the API, and will check both caches (available and unavailable). To fetch directly from the API, use the fetch() method. To get from the available cache only, use the get() method on the cache property (e.g. guilds.cache.get()).

Parameters

Name Type Description
target string | GuildPartial | Guild The ID guild.

Returns

undefined | GuildPartial | Guild

The Guild if available, otherwise a GuildPartial. Returns undefined if the guild is not cached.

Defined in

src/classes/managers/GuildsManager.ts:40


total

total(): number

Returns

number

The total amount of guilds the client is in.

Defined in

src/classes/managers/GuildsManager.ts:94