As Jakye mentioned in their comment, you can check your guild#features. The features property returns an array of Features; if this array includes the string COMMUNITY, your guild is a community server.
Here is a helper function:
function isCommunity(guild) {
return guild.features?.includes('COMMUNITY');
}
And you can use it like this for example:
if (isCommunity(message.guild))
message.channel.send(`${message.guild.name} is a community server`);