mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
add channel.sendMessage and channel.sendTTSMessage
This commit is contained in:
20
src/structures/interface/TextBasedChannel.js
Normal file
20
src/structures/interface/TextBasedChannel.js
Normal 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;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user