mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 16:30:58 -05:00
improve roleUpdate event a bit better.
This commit is contained in:
parent
76b58f5b36
commit
419a38cff2
@ -10,7 +10,7 @@
|
|||||||
"commands": false,
|
"commands": false,
|
||||||
"logs": true,
|
"logs": true,
|
||||||
"automod": false,
|
"automod": false,
|
||||||
"mpstats": true,
|
"mpstats": false,
|
||||||
"mpstatsDebug": false,
|
"mpstatsDebug": false,
|
||||||
"autores": false
|
"autores": false
|
||||||
},
|
},
|
||||||
|
@ -11,11 +11,19 @@ export default {
|
|||||||
if (!roleLog) return
|
if (!roleLog) return
|
||||||
const {executor, target} = roleLog;
|
const {executor, target} = roleLog;
|
||||||
if (target) {
|
if (target) {
|
||||||
const embed = new client.embed().setColor(newRole.hexColor).setTimestamp().setTitle(`Role modified: ${oldRole.name}`).setDescription(`🔹 **Role**\n${target}\n\`${target.id}\``).addFields(
|
const embed = new client.embed().setColor(newRole.hexColor).setThumbnail(newRole?.iconURL()).setTimestamp().setTitle(`Role modified: ${newRole.name}`).setDescription(`🔹 **Role**\n${target}\n\`${target.id}\``).addFields(
|
||||||
{name: `${executor.bot ? '🔹 Bot' : '🔹 Admin'}`, value: `<@${executor.id}>\n\`${executor.id}\``},
|
{name: `${executor.bot ? '🔹 Bot' : '🔹 Admin'}`, value: `<@${executor.id}>\n\`${executor.id}\``}
|
||||||
{name: '🔹 Role changes', value: `**Old color:** ${oldRole.hexColor}\n**New color:** ${newRole.hexColor}`}
|
|
||||||
);
|
);
|
||||||
(client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send({embeds: [embed]})
|
(client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send({embeds: [embed]})
|
||||||
|
// Moved addFields to these below cuz yes for each role changes, it seems inefficent to me but it will do. :)
|
||||||
|
// Permissions field seems to trigger when role is hoisted/unhoisted atleast to me.
|
||||||
|
if (oldRole.hexColor !== newRole.hexColor) {
|
||||||
|
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 {
|
} else {
|
||||||
console.log(`${target.id} was modified from ${client.guilds.cache.get(oldRole.guild.name)} but no audit log could be fetched.`)
|
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