Skip to content

feat(/code *): add option to override content trim behaviour #47

Description

@sudojunior

Add an option that allows resulting content to be oversized, and fallback to processing the result as a file if it is too large - similar to the behaviour of all /debug * commands (chat, user and message).

/code * ... {option}: boolean

  1. disable_trim = false
  2. trim_content = true

while (content.length > 2000) {
amendNotes.add('Requested content was trimmed.');
const lines = content.split('\n');
// #region trim location
if (subCommand === 'entity' && trimTopThisTime) {
lines.splice(notesCount + 2, 1);
actualStart++;
} else {
lines.splice(-2, 1);
actualEnd--;
}
trimTopThisTime = !trimTopThisTime;
// #endregion
// #region notes re-injection
if (amendNotes.size !== notesCount) {
const notesLines = [...amendNotes].map((note) => `> ${note}`);
lines.splice(1, notesCount, ...notesLines);
notesCount = amendNotes.size;
}
// #endregion
lines[0] = this.generateContentHeader(file, [startLine, actualStart], [endLine, actualEnd]);
content = lines.join('\n');
}

It is worth noting that Discord stable doesn't appear to have the file preview which its siblings have had for some time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions