mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Utilise Collection#equals for structures' equals (#986)
Utilizing Collection.equals in GuildChannel.equals Utilizing Collection.equals in GroupDMChannel.equals
This commit is contained in:
committed by
Schuyler Cebulskie
parent
bef0523ebf
commit
906bb3c5f3
@@ -1,7 +1,6 @@
|
|||||||
const Channel = require('./Channel');
|
const Channel = require('./Channel');
|
||||||
const TextBasedChannel = require('./interface/TextBasedChannel');
|
const TextBasedChannel = require('./interface/TextBasedChannel');
|
||||||
const Collection = require('../util/Collection');
|
const Collection = require('../util/Collection');
|
||||||
const arraysEqual = require('../util/ArraysEqual');
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
{ type: 3,
|
{ type: 3,
|
||||||
@@ -101,9 +100,7 @@ class GroupDMChannel extends Channel {
|
|||||||
this.ownerID === channel.ownerID;
|
this.ownerID === channel.ownerID;
|
||||||
|
|
||||||
if (equal) {
|
if (equal) {
|
||||||
const thisIDs = this.recipients.keyArray();
|
return this.recipients.equals(channel.recipients);
|
||||||
const otherIDs = channel.recipients.keyArray();
|
|
||||||
return arraysEqual(thisIDs, otherIDs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return equal;
|
return equal;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const PermissionOverwrites = require('./PermissionOverwrites');
|
|||||||
const EvaluatedPermissions = require('./EvaluatedPermissions');
|
const EvaluatedPermissions = require('./EvaluatedPermissions');
|
||||||
const Constants = require('../util/Constants');
|
const Constants = require('../util/Constants');
|
||||||
const Collection = require('../util/Collection');
|
const Collection = require('../util/Collection');
|
||||||
const arraysEqual = require('../util/ArraysEqual');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a guild channel (i.e. text channels and voice channels)
|
* Represents a guild channel (i.e. text channels and voice channels)
|
||||||
@@ -273,9 +272,7 @@ class GuildChannel extends Channel {
|
|||||||
|
|
||||||
if (equal) {
|
if (equal) {
|
||||||
if (this.permissionOverwrites && channel.permissionOverwrites) {
|
if (this.permissionOverwrites && channel.permissionOverwrites) {
|
||||||
const thisIDSet = this.permissionOverwrites.keyArray();
|
equal = this.permissionOverwrites.equals(channel.permissionOverwrites);
|
||||||
const otherIDSet = channel.permissionOverwrites.keyArray();
|
|
||||||
equal = arraysEqual(thisIDSet, otherIDSet);
|
|
||||||
} else {
|
} else {
|
||||||
equal = !this.permissionOverwrites && !channel.permissionOverwrites;
|
equal = !this.permissionOverwrites && !channel.permissionOverwrites;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user