Skip to content

Commit

Permalink
Add Message.editCode
Browse files Browse the repository at this point in the history
  • Loading branch information
Gawdl3y committed Sep 19, 2016
1 parent e0b614c commit 46d7ded
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/docs.json

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/structures/Message.js
Expand Up @@ -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
Expand All @@ -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>}
Expand Down

0 comments on commit 46d7ded

Please sign in to comment.