Display all webhooks in the current discord server discord.js

I am trying to make a command to display every webhook made in the specific guild, I thought this would work:

let allwebhooks = "";
  
  message.guilds.cache.forEach(webhook => {
    allwebhooks += `${hook.name}, `;
  });
  let webhookembed = new Discord.MessageEmbed()
  .setColor("#8f82ff")
  .setTitle(`There are ${hook.size} webhooks in: **${message.guild.name}**:`)
  .setDescription(
    `Webhooks: \n **${allwebhooks.slice(
    0,
      allwebhooks.length - 2
    )}**`
    );
    message.channel.send(webhookembed)

But I get this error:

TypeError: Cannot read property ‘cache’ of undefined

97 thoughts on “Display all webhooks in the current discord server discord.js”

  1. 989458 400105Spot ill carry on with this write-up, I truly believe this site requirements a fantastic deal much more consideration. Ill oftimes be once a lot more to see far more, several thanks that info. 457582

    Reply

Leave a Comment