From 3a16f5147db22a98d8f9488b282950165223deac Mon Sep 17 00:00:00 2001 From: Hyper-Coder Date: Mon, 22 Aug 2016 21:12:46 -0400 Subject: [PATCH] Added message.reply (#529) --- src/structures/Message.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/structures/Message.js b/src/structures/Message.js index ed8e2c960..7a02711a0 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -244,6 +244,21 @@ class Message { edit(content) { return this.client.rest.methods.updateMessage(this, content); } + + /** + * Reply to a message + * @param {String} content the content of the message + * @param {MessageOptions} [options = {}] the options to provide + * @returns {Promise} + * @example + * // reply to a message + * message.reply('Hey, I'm a reply!') + * .then(msg => console.log(`Sent a reply to ${msg.author}`)) + * .catch(console.log); + */ + reply(content, options = {}) { + return this.client.rest.methods.sendMessage(this.channel, this.guild ? `${this.author}, ${content}` : content, options.tts); + } } module.exports = Message;