commit 72367c0f8973fb21dc22e1f9eff7db56e9042d93
parent 140d762a3c335c53120b1bd716a850130ccf9a28
Author: Demonstrandum <moi@knutsen.co>
Date: Thu, 21 May 2020 00:37:01 +0100
Split retains newlines.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/commands/code.ts b/lib/commands/code.ts
@@ -23,13 +23,13 @@ export default (homescope : HomeScope) => {
const msg = `Source code for \`${p}${command}\`:`;
if (source.length > 1900) {
- const chunks = glue_strings(source.split('\n'), 1950);
+ const chunks = glue_strings(source.split(/^/m), 1950);
+
+ message.channel.send(msg);
for (const chunk of chunks)
message.channel.send(
chunk.format(FORMATS.code_block, 'typescript'));
-
- message.channel.send(msg);
} else {
message.channel.send(`${msg}\n`
+ source.format(FORMATS.code_block, 'typescript'));