mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
ESLint stuff...
This commit is contained in:
@@ -1,44 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
const Action = require('./Action');
|
||||
const Constants = require('../../util/Constants');
|
||||
const CloneObject = require('../../util/CloneObject');
|
||||
const Message = require('../../structures/Message');
|
||||
const cloneObject = require('../../util/CloneObject');
|
||||
|
||||
class GuildRoleUpdateAction extends Action {
|
||||
|
||||
constructor(client) {
|
||||
super(client);
|
||||
}
|
||||
handle(data) {
|
||||
const client = this.client;
|
||||
const guild = client.store.get('guilds', data.guild_id);
|
||||
|
||||
handle(data) {
|
||||
const roleData = data.role;
|
||||
|
||||
let client = this.client;
|
||||
let guild = client.store.get('guilds', data.guild_id);
|
||||
if (guild) {
|
||||
let oldRole;
|
||||
const existingRole = guild.store.get('roles', roleData.id);
|
||||
// exists and not the same
|
||||
if (existingRole && !existingRole.equals(roleData)) {
|
||||
oldRole = cloneObject(existingRole);
|
||||
existingRole.setup(data.role);
|
||||
client.emit(Constants.Events.GUILD_ROLE_UPDATE, guild, oldRole, existingRole);
|
||||
}
|
||||
|
||||
let roleData = data.role;
|
||||
return {
|
||||
old: oldRole,
|
||||
updated: existingRole,
|
||||
};
|
||||
}
|
||||
|
||||
if (guild) {
|
||||
let oldRole;
|
||||
let existingRole = guild.store.get('roles', roleData.id);
|
||||
// exists and not the same
|
||||
if (existingRole && !existingRole.equals(roleData)) {
|
||||
oldRole = CloneObject(existingRole);
|
||||
existingRole.setup(data.role);
|
||||
client.emit(Constants.Events.GUILD_ROLE_UPDATE, guild, oldRole, existingRole);
|
||||
}
|
||||
|
||||
return {
|
||||
old: oldRole,
|
||||
updated: existingRole,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
old: null,
|
||||
updated: null,
|
||||
};
|
||||
}
|
||||
};
|
||||
return {
|
||||
old: null,
|
||||
updated: null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GuildRoleUpdateAction;
|
||||
|
||||
Reference in New Issue
Block a user