mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Add Message.editCode
This commit is contained in:
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
|
* @param {StringResolvable} content The new content for the message
|
||||||
* @returns {Promise<Message>}
|
* @returns {Promise<Message>}
|
||||||
* @example
|
* @example
|
||||||
@@ -301,6 +301,17 @@ class Message {
|
|||||||
return this.client.rest.methods.updateMessage(this, content);
|
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
|
* Pins this message to the channel's pinned messages
|
||||||
* @returns {Promise<Message>}
|
* @returns {Promise<Message>}
|
||||||
|
|||||||
Reference in New Issue
Block a user