refactor: removed code and split options (#5918)

Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com>

BREAKING CHANGE: Removed `APIMessage#split`
BREAKING CHANGE: Removed `MessageEditOptions#code`
BREAKING CHANGE: Removed `BaseMessageOptions#code`
BREAKING CHANGE: Removed `BaseMessageOptions#split`
This commit is contained in:
Antonio Román
2021-06-27 00:11:40 +02:00
committed by GitHub
parent 0d0c8f07f2
commit 985d4d6a43
7 changed files with 19 additions and 101 deletions

View File

@@ -62,9 +62,6 @@ class TextBasedChannel {
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
* (see [here](https://discord.com/developers/docs/resources/channel#allowed-mentions-object) for more details)
* @property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] Files to send with the message
* @property {string|boolean} [code] Language for optional codeblock formatting to apply
* @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if
* it exceeds the character limit. If an object is provided, these are the options for splitting the message
* @property {MessageActionRow[]|MessageActionRowOptions[]|MessageActionRowComponentResolvable[][]} [components]
* Action rows containing interactive components for the message (buttons, select menus)
*/
@@ -98,16 +95,6 @@ class TextBasedChannel {
* @property {string} [name='file.jpg'] Filename of the attachment
*/
/**
* Options for splitting a message.
* @typedef {Object} SplitOptions
* @property {number} [maxLength=2000] Maximum character length per message piece
* @property {string|string[]|RegExp|RegExp[]} [char='\n'] Character(s) or Regex(s) to split the message with,
* an array can be used to split multiple times
* @property {string} [prepend=''] Text to prepend to every piece except the first
* @property {string} [append=''] Text to append to every piece except the last
*/
/**
* Options for sending a message with a reply.
* @typedef {Object} ReplyOptions
@@ -177,10 +164,6 @@ class TextBasedChannel {
apiMessage = APIMessage.create(this, options).resolveData();
}
if (Array.isArray(apiMessage.data.content)) {
return Promise.all(apiMessage.split().map(this.send.bind(this)));
}
const { data, files } = await apiMessage.resolveFiles();
return this.client.api.channels[this.id].messages
.post({ data, files })