mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
Add Message.editCode
This commit is contained in:
parent
e0b614c3b2
commit
46d7dedc85
2 changed files with 13 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
|
@ -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>}
|
||||
|
|
|
|||
Loading…
Reference in a new issue