mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -05:00
fix perms ?bug?
This commit is contained in:
parent
5908ae5631
commit
addf4573c9
@ -3,11 +3,11 @@ import { TClient } from '../client';
|
||||
export default {
|
||||
name: 'roleUpdate',
|
||||
execute: async(client:TClient, oldRole:Discord.Role, newRole:Discord.Role)=>{
|
||||
if (oldRole.guild?.id != client.config.mainServer.id) return;
|
||||
const fetchRoleUpdoot = await client.guilds.cache.get(oldRole.guild.id).fetchAuditLogs({
|
||||
limit: 1,
|
||||
type: AuditLogEvent.RoleUpdate
|
||||
})
|
||||
if (oldRole.guild?.id != client.config.mainServer.id) return;
|
||||
const roleLog = fetchRoleUpdoot.entries.first();
|
||||
if (!roleLog) return
|
||||
const {executor, target} = roleLog;
|
||||
@ -22,8 +22,8 @@ export default {
|
||||
embed.addFields({name: '🔹 Role changes', value: `**Old color:** ${oldRole.hexColor}\n**New color:** ${newRole.hexColor}`})
|
||||
} else if (oldRole.name !== newRole.name) {
|
||||
embed.addFields({name: '🔹 Role changes', value: `**Old name:** ${oldRole.name}\n**New name:** ${newRole.name}`})
|
||||
} else if (oldRole.permissions !== newRole.permissions) {
|
||||
embed.addFields({name: '🔹 Role changes', value: `**Old permission(s):** ${newRole.permissions.missing(oldRole.permissions)}\n**New permission(s):** ${oldRole.permissions.missing(newRole.permissions)}`})
|
||||
} else if (!oldRole.permissions.equals(newRole.permissions)) {
|
||||
embed.addFields({name: '🔹 Role changes', value: `**Old permission(s):** ${newRole.permissions.missing(oldRole.permissions).join(', ')}\n**New permission(s):** ${oldRole.permissions.missing(newRole.permissions).join(', ')}`})
|
||||
}
|
||||
} else {
|
||||
console.log(`${target.id} was modified from ${client.guilds.cache.get(oldRole.guild.name)} but no audit log could be fetched.`)
|
||||
|
Loading…
Reference in New Issue
Block a user