Add Message.editCode

This commit is contained in:
Schuyler Cebulskie
2016-09-19 15:14:48 -04:00
parent e0b614c3b2
commit 46d7dedc85
2 changed files with 13 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@@ -288,7 +288,7 @@ class Message {
}
/**
* Edit the content of a message
* Edit the content of the message
* @param {StringResolvable} content The new content for the message
* @returns {Promise<Message>}
* @example
@@ -301,6 +301,17 @@ class Message {
return this.client.rest.methods.updateMessage(this, content);
}
/**
* Edit the content of the message, with a code block
* @param {string} lang Language for the code block
* @param {StringResolvable} content The new content for the message
* @returns {Promise<Message>}
*/
editCode(lang, content) {
content = this.client.resolver.resolveString(content).replace(/```/g, '`\u200b``');
return this.edit(`\`\`\`${lang ? lang : ''}\n${content}\n\`\`\``);
}
/**
* Pins this message to the channel's pinned messages
* @returns {Promise<Message>}