Add search (#1043)

* add search

* Update ClientDataResolver.js
This commit is contained in:
Gus Caplan
2016-12-30 01:44:19 -06:00
committed by Schuyler Cebulskie
parent f0adf8f122
commit beffb390e6
8 changed files with 290 additions and 0 deletions

View File

@@ -123,6 +123,19 @@ class ClientDataResolver {
return null;
}
/**
* Resolves a ChannelResolvable to a Channel object
* @param {ChannelResolvable} channel The channel resolvable to resolve
* @returns {?string}
*/
resolveChannelID(channel) {
if (channel instanceof Channel) return channel.id;
if (typeof channel === 'string') return channel;
if (channel instanceof Message) return channel.channel.id;
if (channel instanceof Guild) return channel.defaultChannel.id;
return null;
}
/**
* Data that can be resolved to give an invite code. This can be:
* * An invite code