Skip to content

Commit 7b09f62

Browse files
author
Slingexe
authored
+ Better formatting to stay clear from discord's acsi rendering limit per message
1 parent 7d22fb7 commit 7b09f62

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

formattertest.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
const { readFile } = require('fs/promises');
2+
const path = require('node:path');
3+
const fs = require('node:fs');
4+
5+
6+
const logpath = path.resolve(__dirname, 'formattest-log.txt');
7+
18
// Full Hackmud-to-Discord color mapping //  = U+001B
29
const hackmudToDiscordColors = {
310
'reset': '', // Reset text formatting
@@ -133,6 +140,16 @@ const message3 = {
133140
"from_user": "com",
134141
"msg": "psst, this is a tell"
135142
};
143+
const messagespam = {
144+
"id": "3598b8a024e394b691559a8c",
145+
"t": 1515984655.629,
146+
"from_user": "sans_comedy",
147+
"msg": "`2T``3h``2i``3s``2 ``3i``2s``3 ``2a``3 ``2c``3o``2l``3o``2r``3f``2u``3l``2 ``3m``2e``3s``2s``3a``2g``3e``5!`",
148+
"channel": "0000"
149+
};
136150

137151
// Test the Formatter
138-
console.log('Formatted Message:\n' + Formatter(message1) + '\n' + Formatter(message2) + '\n' + Formatter(message3));
152+
console.log('Formatted Message:\n' + Formatter(message1) + '\n' + Formatter(message2) + '\n' + Formatter(message3)+ '\n' + Formatter(messagespam));
153+
154+
// Write to log
155+
fs.writeFileSync(logpath, Formatter(messagespam), null, 4);

0 commit comments

Comments
 (0)