mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00: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:
parent
bef0523ebf
commit
906bb3c5f3
2 changed files with 2 additions and 8 deletions
|
|
@ -1,7 +1,6 @@
|
|||
const Channel = require('./Channel');
|
||||
const TextBasedChannel = require('./interface/TextBasedChannel');
|
||||
const Collection = require('../util/Collection');
|
||||
const arraysEqual = require('../util/ArraysEqual');
|
||||
|
||||
/*
|
||||
{ type: 3,
|
||||
|
|
@ -101,9 +100,7 @@ class GroupDMChannel extends Channel {
|
|||
this.ownerID === channel.ownerID;
|
||||
|
||||
if (equal) {
|
||||
const thisIDs = this.recipients.keyArray();
|
||||
const otherIDs = channel.recipients.keyArray();
|
||||
return arraysEqual(thisIDs, otherIDs);
|
||||
return this.recipients.equals(channel.recipients);
|
||||
}
|
||||
|
||||
return equal;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ const PermissionOverwrites = require('./PermissionOverwrites');
|
|||
const EvaluatedPermissions = require('./EvaluatedPermissions');
|
||||
const Constants = require('../util/Constants');
|
||||
const Collection = require('../util/Collection');
|
||||
const arraysEqual = require('../util/ArraysEqual');
|
||||
|
||||
/**
|
||||
* Represents a guild channel (i.e. text channels and voice channels)
|
||||
|
|
@ -273,9 +272,7 @@ class GuildChannel extends Channel {
|
|||
|
||||
if (equal) {
|
||||
if (this.permissionOverwrites && channel.permissionOverwrites) {
|
||||
const thisIDSet = this.permissionOverwrites.keyArray();
|
||||
const otherIDSet = channel.permissionOverwrites.keyArray();
|
||||
equal = arraysEqual(thisIDSet, otherIDSet);
|
||||
equal = this.permissionOverwrites.equals(channel.permissionOverwrites);
|
||||
} else {
|
||||
equal = !this.permissionOverwrites && !channel.permissionOverwrites;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue