Files
discord.js-selfbot/src/client/actions/GuildRoleUpdate.js

40 lines
881 B
JavaScript
Raw Normal View History

2022-03-19 17:37:45 +07:00
'use strict';
const Action = require('./Action');
const { Events } = require('../../util/Constants');
2022-03-19 17:37:45 +07:00
class GuildRoleUpdateAction extends Action {
handle(data) {
const client = this.client;
const guild = client.guilds.cache.get(data.guild_id);
if (guild) {
let old = null;
const role = guild.roles.cache.get(data.role.id);
if (role) {
old = role._update(data.role);
/**
* Emitted whenever a guild role is updated.
* @event Client#roleUpdate
* @param {Role} oldRole The role before the update
* @param {Role} newRole The role after the update
*/
client.emit(Events.GUILD_ROLE_UPDATE, old, role);
2022-03-19 17:37:45 +07:00
}
return {
old,
updated: role,
};
}
return {
old: null,
updated: null,
};
}
}
module.exports = GuildRoleUpdateAction;