add channel.sendMessage and channel.sendTTSMessage

This commit is contained in:
hydrabolt
2016-04-21 17:42:52 +01:00
parent b8283a8f29
commit f3e1760538
7 changed files with 61 additions and 11 deletions

View File

@@ -0,0 +1,20 @@
'use strict';
function sendMessage(content, options) {
options = options || {};
return this.client.rest.methods.SendMessage(this, content, options.tts);
}
function sendTTSMessage(content, options) {
options = options || {};
return this.client.rest.methods.SendMessage(this, content, true);
}
exports.applyToClass = structure => {
if (structure.name !== 'TextChannel' && structure.name !== 'DMChannel') {
throw new Error(structure + ' cannot implement TextBasedChannel');
}
structure.prototype.sendMessage = sendMessage;
};