mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
refactor(*): make typedefs for all options params (#5785)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com> Co-authored-by: Antonio Román <kyradiscord@gmail.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
@@ -90,19 +90,24 @@ class Util {
|
||||
return messages.concat(msg).filter(m => m);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to escape markdown.
|
||||
* @typedef {Object} EscapeMarkdownOptions
|
||||
* @property {boolean} [codeBlock=true] Whether to escape code blocks or not
|
||||
* @property {boolean} [inlineCode=true] Whether to escape inline code or not
|
||||
* @property {boolean} [bold=true] Whether to escape bolds or not
|
||||
* @property {boolean} [italic=true] Whether to escape italics or not
|
||||
* @property {boolean} [underline=true] Whether to escape underlines or not
|
||||
* @property {boolean} [strikethrough=true] Whether to escape strikethroughs or not
|
||||
* @property {boolean} [spoiler=true] Whether to escape spoilers or not
|
||||
* @property {boolean} [codeBlockContent=true] Whether to escape text inside code blocks or not
|
||||
* @property {boolean} [inlineCodeContent=true] Whether to escape text inside inline code or not
|
||||
*/
|
||||
|
||||
/**
|
||||
* Escapes any Discord-flavour markdown in a string.
|
||||
* @param {string} text Content to escape
|
||||
* @param {Object} [options={}] What types of markdown to escape
|
||||
* @param {boolean} [options.codeBlock=true] Whether to escape code blocks or not
|
||||
* @param {boolean} [options.inlineCode=true] Whether to escape inline code or not
|
||||
* @param {boolean} [options.bold=true] Whether to escape bolds or not
|
||||
* @param {boolean} [options.italic=true] Whether to escape italics or not
|
||||
* @param {boolean} [options.underline=true] Whether to escape underlines or not
|
||||
* @param {boolean} [options.strikethrough=true] Whether to escape strikethroughs or not
|
||||
* @param {boolean} [options.spoiler=true] Whether to escape spoilers or not
|
||||
* @param {boolean} [options.codeBlockContent=true] Whether to escape text inside code blocks or not
|
||||
* @param {boolean} [options.inlineCodeContent=true] Whether to escape text inside inline code or not
|
||||
* @param {EscapeMarkdownOptions} [options={}] Options for escaping the markdown
|
||||
* @returns {string}
|
||||
*/
|
||||
static escapeMarkdown(
|
||||
@@ -323,12 +328,17 @@ class Util {
|
||||
return given;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to make an error object.
|
||||
* @typedef {Object} MakeErrorOptions
|
||||
* @property {string} name Error type
|
||||
* @property {string} message Message for the error
|
||||
* @property {string} stack Stack for the error
|
||||
*/
|
||||
|
||||
/**
|
||||
* Makes an Error from a plain info object.
|
||||
* @param {Object} obj Error info
|
||||
* @param {string} obj.name Error type
|
||||
* @param {string} obj.message Message for the error
|
||||
* @param {string} obj.stack Stack for the error
|
||||
* @param {MakeErrorOptions} obj Error info
|
||||
* @returns {Error}
|
||||
* @private
|
||||
*/
|
||||
@@ -342,7 +352,7 @@ class Util {
|
||||
/**
|
||||
* Makes a plain error info object from an Error.
|
||||
* @param {Error} err Error to get info from
|
||||
* @returns {Object}
|
||||
* @returns {MakeErrorOptions}
|
||||
* @private
|
||||
*/
|
||||
static makePlainError(err) {
|
||||
|
||||
Reference in New Issue
Block a user