Estaba hurgando en una fuente antigua de discord.js de v11, y fusioné la mayor parte con v12, tenga en cuenta que este script está fallando dentro del evento ready , preferiría no ponerlo en otro lugar.
Esto es lo que tengo por ahora:
client.on('ready', async () => { log.success(`Authenticated as ${client.user.tag}`); client.user.setPresence({ activity: { name: env.PRESENCE_ACTIVITY, type: env.PRESENCE_TYPE.toUpperCase(), }, }); const guild = client.guilds.cache.find((g) => g.id === '000000000'); if (!guild) return console.log(`Can't find any guild with the ID "${env.GUILD_ID}"`); if (guild.member.hasPermission('ADMINISTRATOR', false)) { log.success("Bot has the 'ADMINISTRATOR' permission"); } else log.warn("Bot does not have 'ADMINISTRATOR' permission"); client.guilds.cache .get(env.GUILD_ID) .roles.fetch() .then((roles) => { goodieRole = roles.cache.get(env.GOODIE_ROLE_ID); }); });No hay propiedad de member en los guild . Si desea obtener el bot como miembro de ese guild , puede obtenerlos fetch() de guild.members . Si está usando discord.js v12, puede usar el método hasPermission() para verificar si el bot tiene un indicador de ADMINISTRATOR :
client.on('ready', async () => { log.success(`Authenticated as ${client.user.tag}`); client.user.setPresence({ activity: { name: env.PRESENCE_ACTIVITY, type: env.PRESENCE_TYPE.toUpperCase(), }, }); const guild = client.guilds.cache.get(env.GUILD_ID); if (!guild) return console.log(`Can't find any guild with the ID "${env.GUILD_ID}"`); let botMember = await guild.members.fetch(client.user); if (botMember.hasPermission('ADMINISTRATOR', false)) { log.success("Bot has the 'ADMINISTRATOR' permission"); } else log.warn("Bot does not have 'ADMINISTRATOR' permission"); // ...