Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sudojunior opened this issue Aug 11, 2023 · 0 comments
Open

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

sudojunior opened this issue Aug 11, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@sudojunior
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant