pןɐnɯoᴚ
pןɐnɯoᴚ
DIAdiscord.js - Imagine an app
Created by pןɐnɯoᴚ on 10/21/2024 in #djs-questions
How do I convert this a permission int into an PermissionString[]
Hello, I am watching the GuildAuditLogEntryCreate event and when a permission is updated i am getting this in the entry changes: [ { key: 'permissions', old: 8797166764176, new: 8797166764160 } ], I want to see which permissions has been changes so I hhave seen on the documentation that I can use PermissionsBitsField, I wrote this

if (e.key == 'permissions') {
let oldPerm = new PermissionsBitField(e.old).toArray()
let newPerm = new PermissionsBitField(e.new).toArray()
console.log({ oldPerm, newPerm })
}

if (e.key == 'permissions') {
let oldPerm = new PermissionsBitField(e.old).toArray()
let newPerm = new PermissionsBitField(e.new).toArray()
console.log({ oldPerm, newPerm })
}
But I am getting an error and I dont know what I am doing wrong, thanks for the help RangeError [BitFieldInvalid]: Invalid bitfield flag or number: 8797166764176.
9 replies