so basically what i wanted is to make the bot send a message in the serverLogs
channel whenever a channel in that guild is deleted. The message sends general information about the deleted channel, but i wanted to expand this embed to make it say what permission overwrites dide that channel have so i tried console logging it to see what kind of info i get.
client.on('channelDelete', (channel) => {
if(channel.type === 'dm') return;
const serverLogs = channel.guild.channels.cache.get(serverLog);
if (typeof serverLogs !== 'undefined') {
const embed = new Discord.MessageEmbed()
.setColor('#DB0000')
.setTimestamp()
.setTitle('Channel Deleted')
.addFields(
{ name:'name', value:channel.name, inline: false },
{ name:'Category', value:channel.parent, inline: false },
{ name:'created at', value:`${moment(channel.createdAt).format('MMMM Do YYYY, h:mm:ss a')}`, inline: false },
{ name:'ID', value: channel.id, inline: false },
);
serverLogs.send(embed);
// YOU CAN IGNORE ALL OF THE ABOVE
channel.permissionOverwrites
.each(E=>console.log(`<@${E.id}>`))
.each(E=>console.log(E.deny))
.each(E=>console.log(E.allow));
/*output
<@/*id here hehe*/>
Permissions { bitfield: 16 } //wtf is 16
Permissions { bitfield: 1024 }// wtf is 1024
*/
}
});
Is there a way to translate these decimals to normal permission Flags so i can read and manipulate them easier
question from:
https://stackoverflow.com/questions/66062106/how-to-translate-discord-js-decimals 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…