mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
Stop comparing for equality on update events and just emit for performance
This commit is contained in:
@@ -10,7 +10,7 @@ class ChannelUpdateAction extends Action {
|
||||
if (channel) {
|
||||
const oldChannel = cloneObject(channel);
|
||||
channel.setup(data);
|
||||
if (!oldChannel.equals(data)) client.emit(Constants.Events.CHANNEL_UPDATE, oldChannel, channel);
|
||||
client.emit(Constants.Events.CHANNEL_UPDATE, oldChannel, channel);
|
||||
return {
|
||||
old: oldChannel,
|
||||
updated: channel,
|
||||
|
||||
@@ -12,7 +12,7 @@ class GuildRoleUpdateAction extends Action {
|
||||
let oldRole = null;
|
||||
|
||||
const role = guild.roles.get(roleData.id);
|
||||
if (role && !role.equals(roleData)) {
|
||||
if (role) {
|
||||
oldRole = cloneObject(role);
|
||||
role.setup(data.role);
|
||||
client.emit(Constants.Events.GUILD_ROLE_UPDATE, guild, oldRole, role);
|
||||
|
||||
@@ -10,7 +10,7 @@ class GuildUpdateAction extends Action {
|
||||
if (guild) {
|
||||
const oldGuild = cloneObject(guild);
|
||||
guild.setup(data);
|
||||
if (!oldGuild.equals(data)) client.emit(Constants.Events.GUILD_UPDATE, oldGuild, guild);
|
||||
client.emit(Constants.Events.GUILD_UPDATE, oldGuild, guild);
|
||||
return {
|
||||
old: oldGuild,
|
||||
updated: guild,
|
||||
|
||||
@@ -9,7 +9,7 @@ class MessageUpdateAction extends Action {
|
||||
const channel = client.channels.get(data.channel_id);
|
||||
if (channel) {
|
||||
const message = channel.messages.get(data.id);
|
||||
if (message && !message.equals(data, true)) {
|
||||
if (message) {
|
||||
const oldMessage = cloneObject(message);
|
||||
message.patch(data);
|
||||
message._edits.unshift(oldMessage);
|
||||
|
||||
Reference in New Issue
Block a user