async createGuild(name, icon) {
    const { client } = this;
    const data = await client.api.guilds.templates(this.code).post({
      data: {
        name,
        icon: await DataResolver.resolveImage(icon),
      },
    });
    // eslint-disable-next-line consistent-return
    return new Promise(resolve => {
      const createdGuild = client.guilds.cache.get(data.id);
      if (createdGuild) return resolve(createdGuild);

      const resolveGuild = guild => {
        client.off(Events.GUILD_CREATE, handleGuild);
        client.decrementMaxListeners();
        resolve(guild);
      };

      const handleGuild = guild => {
        if (guild.id === data.id) {
          client.clearTimeout(timeout);
          resolveGuild(guild);
        }
      };

      client.incrementMaxListeners();
      client.on(Events.GUILD_CREATE, handleGuild);

      const timeout = client.setTimeout(() => resolveGuild(client.guilds.add(data)), 10000);
    });
  }
/**
   * Creates a guild based from this template.
   * <warn>This is only available to bots in fewer than 10 guilds.</warn>
   * @param {string} name The name of the guild
   * @param {BufferResolvable|Base64Resolvable} [icon] The icon for the guild
   * @returns {Promise<Guild>}
   */
Creates a guild based from this template.
This is only available to bots in fewer than 10 guilds.
@param {string} name The name of the guild
@param {BufferResolvable|Base64Resolvable} [icon] The icon for the guild
@returns {Promise}
Creates a guild based from this template . This is only available to bots in fewer than 10 guilds . @param { string } name The name of the guild @param { BufferResolvable|Base64Resolvable } [ icon ] The icon for the guild @returns { Promise }
async createGuild(name, icon) {
    const { client } = this;
    const data = await client.api.guilds.templates(this.code).post({
      data: {
        name,
        icon: await DataResolver.resolveImage(icon),
      },
    });
    return new Promise(resolve => {
      const createdGuild = client.guilds.cache.get(data.id);
      if (createdGuild) return resolve(createdGuild);
      const resolveGuild = guild => {
        client.off(Events.GUILD_CREATE, handleGuild);
        client.decrementMaxListeners();
        resolve(guild);
      };
      const handleGuild = guild => {
        if (guild.id === data.id) {
          client.clearTimeout(timeout);
          resolveGuild(guild);
        }
      };
      client.incrementMaxListeners();
      client.on(Events.GUILD_CREATE, handleGuild);
      const timeout = client.setTimeout(() => resolveGuild(client.guilds.add(data)), 10000);
    });
  }
async createGuild ( name , icon ) { const { client } = this ; const data = await client . api . guilds . templates ( this . code ) . post ( { data : { name , icon : await DataResolver . resolveImage ( icon ) , } , } ) ; return new Promise ( resolve => { const createdGuild = client . guilds . cache . get ( data . id ) ; if ( createdGuild ) return resolve ( createdGuild ) ; const resolveGuild = guild => { client . off ( Events . GUILD_CREATE , handleGuild ) ; client . decrementMaxListeners ( ) ; resolve ( guild ) ; } ; const handleGuild = guild => { if ( guild . id === data . id ) { client . clearTimeout ( timeout ) ; resolveGuild ( guild ) ; } } ; client . incrementMaxListeners ( ) ; client . on ( Events . GUILD_CREATE , handleGuild ) ; const timeout = client . setTimeout ( ( ) => resolveGuild ( client . guilds . add ( data ) ) , 10000 ) ; } ) ; }
Creates a guild based from this template.
Creates a guild based from this template .
// eslint-disable-next-line consistent-return