Skip to content
V2 has arrived! A lot has changed, so treat this as a fresh start.

Fetcher

Fetcher is a cache-first REST wrapper available on every interaction object as interaction.fetcher. It checks the CacheManager before making a live Discord API request, and writes the result back to the cache automatically.

// Inside any handler or middleware
const user = await interaction.fetcher.users.get(userId);

If no cache adapter is configured, Fetcher bypasses the cache and always fetches from the API.

Fetcher is instantiated internally by BaseInteraction — you do not construct it directly.

The raw @discordjs/core API instance. Use this for any Discord REST call not covered by the named accessors.

await interaction.fetcher.api.stickers.get(stickerId);

Fetches a user by ID. Returns the cached value if available, otherwise fetches from Discord and caches the result.

get(channelId: string): Promise<CachedChannel>
Section titled “get(channelId: string): Promise<CachedChannel>”

Fetches a channel by ID. Returns the cached value if available, otherwise fetches from Discord and caches the result.

Fetches a guild by ID. Returns the cached value if available, otherwise fetches from Discord and caches the result.

get(guildId: string, roleId: string): Promise<APIRole>
Section titled “get(guildId: string, roleId: string): Promise<APIRole>”

Fetches a single role. If not cached, fetches all roles for the guild via guilds.getRoles and returns the matching one.

Fetches all roles for a guild. Returns cached roles if available (via CacheManager.getGuildRoles), otherwise fetches from Discord and bulk-caches the result.

get(guildId: string, userId: string): Promise<APIGuildMember | CachedGuildMember>
Section titled “get(guildId: string, userId: string): Promise<APIGuildMember | CachedGuildMember>”

Fetches a guild member by user ID. Returns the cached value if available, otherwise fetches from Discord and caches the result.