From b5026909a1a20d2b68faefe775c9ae4e56b8a0d4 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Mon, 9 Jan 2017 18:20:05 +0000 Subject: [PATCH] Remove DMChannel.bulkDelete and GroupDMChannel.bulkDelete --- src/structures/DMChannel.js | 4 ++-- src/structures/GroupDMChannel.js | 4 ++-- src/structures/interface/TextBasedChannel.js | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/structures/DMChannel.js b/src/structures/DMChannel.js index 6af543dd6..93f277dcc 100644 --- a/src/structures/DMChannel.js +++ b/src/structures/DMChannel.js @@ -52,10 +52,10 @@ class DMChannel extends Channel { get typingCount() { return; } createCollector() { return; } awaitMessages() { return; } - bulkDelete() { return; } + // doesn't work on DM channels; bulkDelete() { return; } _cacheMessage() { return; } } -TextBasedChannel.applyToClass(DMChannel, true); +TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']); module.exports = DMChannel; diff --git a/src/structures/GroupDMChannel.js b/src/structures/GroupDMChannel.js index cf6739fd3..48ef131c9 100644 --- a/src/structures/GroupDMChannel.js +++ b/src/structures/GroupDMChannel.js @@ -136,10 +136,10 @@ class GroupDMChannel extends Channel { get typingCount() { return; } createCollector() { return; } awaitMessages() { return; } - bulkDelete() { return; } + // doesn't work on group DMs; bulkDelete() { return; } _cacheMessage() { return; } } -TextBasedChannel.applyToClass(GroupDMChannel, true); +TextBasedChannel.applyToClass(GroupDMChannel, true, ['bulkDelete']); module.exports = GroupDMChannel; diff --git a/src/structures/interface/TextBasedChannel.js b/src/structures/interface/TextBasedChannel.js index 5e06cb543..829eef683 100644 --- a/src/structures/interface/TextBasedChannel.js +++ b/src/structures/interface/TextBasedChannel.js @@ -372,7 +372,7 @@ class TextBasedChannel { } } -exports.applyToClass = (structure, full = false) => { +exports.applyToClass = (structure, full = false, ignore = []) => { const props = ['send', 'sendMessage', 'sendEmbed', 'sendFile', 'sendCode']; if (full) { props.push( @@ -391,6 +391,7 @@ exports.applyToClass = (structure, full = false) => { ); } for (const prop of props) { + if (ignore.includes(prop)) continue; Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop)); } };