Skip to content

Client.fetchGuildTemplate() throws a TypeError #5039

@WOZARDLOZARD

Description

@WOZARDLOZARD

Please describe the problem you are having in as much detail as possible:
When fetching a server template from the Client, the following error is thrown:
TypeError: this.client.guilds.get is not a function at GuildTemplate.get guild [as guild] (/___/___/___/___/node_modules/discord.js/src/structures/GuildTemplate.js:201:31)

I fixed this myself by changing the specified line (line 201) in the GuildTemplate.js file to this.client.guilds.cache.get(...). Minor issue but this breaks the Client.fetchGuildTemplate() function nonetheless.

Include a reproducible code sample here, if possible:

const { Client } = require('discord.js');
const client = new Client();

client.login("token");

client.fetchGuildTemplate("template code/URL").then(template => {
    // do something here
});

Further details:

  • discord.js version: 12.5.0
  • Node.js version: 14.5.0
  • Operating system: MacOS Big Sur 11.0.1
  • Priority this issue should have – please be realistic and elaborate if possible: Low, can be fixed by yourself

Relevant client options:

  • partials: N/A

  • gateway intents: N/A

  • other: N/A

  • I have also tested the issue on latest master, commit hash:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions