mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 04:10:59 -05:00
improve roleUpdate event a bit better.
This commit is contained in:
parent
1e8f0ab058
commit
d94eff8ece
@ -10,7 +10,7 @@
|
||||
"commands": false,
|
||||
"logs": true,
|
||||
"automod": false,
|
||||
"mpstats": true,
|
||||
"mpstats": false,
|
||||
"mpstatsDebug": false,
|
||||
"autores": false
|
||||
},
|
||||
|
@ -11,11 +11,19 @@ export default {
|
||||
if (!roleLog) return
|
||||
const {executor, target} = roleLog;
|
||||
if (target) {
|
||||
const embed = new client.embed().setColor(newRole.hexColor).setTimestamp().setTitle(`Role modified: ${oldRole.name}`).setDescription(`🔹 **Role**\n${target}\n\`${target.id}\``).addFields(
|
||||
{name: `${executor.bot ? '🔹 Bot' : '🔹 Admin'}`, value: `<@${executor.id}>\n\`${executor.id}\``},
|
||||
{name: '🔹 Role changes', value: `**Old color:** ${oldRole.hexColor}\n**New color:** ${newRole.hexColor}`}
|
||||
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}\``}
|
||||
);
|
||||
(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 {
|
||||
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