File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
29const hackmudToDiscordColors = {
310 'reset' : '[0;0m' , // 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 ) ;
You can’t perform that action at this time.
0 commit comments