fix(ChannelStore): return existing DMChannels within add() (#3438)

* fix: return existing DMChannels

* ref: group nested conditions
This commit is contained in:
izexi
2019-08-28 10:13:09 +01:00
committed by SpaceEEC
parent 745a0ea942
commit 2a3fb705d0

View File

@@ -54,9 +54,9 @@ class ChannelStore extends DataStore {
add(data, guild, cache = true) { add(data, guild, cache = true) {
const existing = this.get(data.id); const existing = this.get(data.id);
if (existing && existing._patch && cache) existing._patch(data); if (existing) {
if (existing && guild) { if (existing._patch && cache) existing._patch(data);
guild.channels.add(existing); if (guild) guild.channels.add(existing);
return existing; return existing;
} }