summary refs log tree commit diff homepage
path: root/src
diff options
context:
space:
mode:
authordestruc7i0n <dscdsouza@outlook.com>2020-04-29 10:00:52 -0400
committerdestruc7i0n <dscdsouza@outlook.com>2020-04-29 10:00:52 -0400
commitb98b5434e2e7accf8c4c06da66bd2dd78b655f3c (patch)
treeaaa37aa02d8215a904df83fed952edad2eec4ca9 /src
parentadd the ability to handle webhook messages (diff)
parentMerge pull request #51 from blandin/master (diff)
downloadshulker-b98b5434e2e7accf8c4c06da66bd2dd78b655f3c.tar.gz
shulker-b98b5434e2e7accf8c4c06da66bd2dd78b655f3c.zip
Merge branch 'master' of https://github.com/destruc7i0n/shulker
Diffstat (limited to 'src')
-rw-r--r--src/Discord.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Discord.ts b/src/Discord.ts
index d8263e8..4f177c8 100644
--- a/src/Discord.ts
+++ b/src/Discord.ts
@@ -126,11 +126,15 @@ class Discord {
   }
 
   private makeMinecraftTellraw(message: Message): string {
-    const username = emojiStrip(message.author.username)
-    const discriminator = message.author.discriminator
-    const text = emojiStrip(message.cleanContent)
+    const variables: {[index: string]: string} = {
+      username: emojiStrip(message.author.username),
+      discriminator: message.author.discriminator,
+      text: emojiStrip(message.cleanContent)
+    }
     // hastily use JSON to encode the strings
-    const variables = JSON.parse(JSON.stringify({ username, discriminator, text }))
+    for (const v of Object.keys(variables)) {
+      variables[v] = JSON.stringify(variables[v]).slice(1,-1)
+    }
 
     return this.config.MINECRAFT_TELLRAW_TEMPLATE
       .replace('%username%', variables.username)
h time-to-ID and piercingsJune McEnroe 2022-07-26Add -w to upJune McEnroe 2022-07-13Set push.autoSetupRemoteJune McEnroe 2022-07-08Remove TOURJune McEnroe 2022-07-03Add The Bone Shard EmperorJune McEnroe 2022-06-25Bump xterm font size to 12June McEnroe 2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe