I did not find any typo and the way you are trying to get the boost count seems correct.
But as the error says, it looks like your guild is null
. Are you using this command in the guild or DM? Let's do basic and simple debugging. Check what you get from console.log(interaction.guild)
or even console.log(interaction)
.
If you get normal data, the problem could be in approaching to the Discord API and getting data from Guild.
AWAIT bot.guilds.fetch(interaction.guild)
await is important!)if (interaction.guild.available)
)By the way, premiumSubscriptionCount
could be null
(check docs here)
PS Are you using the latest discord.js
version?