summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authordestruc7i0n <destruc7i0n@users.noreply.github.com>2021-12-29 16:57:59 -0500
committerdestruc7i0n <destruc7i0n@users.noreply.github.com>2021-12-29 16:57:59 -0500
commit8099fd7ac494c12860145f021c46326a1c784ea0 (patch)
treea6fbe5431c05da1568a1d33588dbb527f83ee797
parentescape unicode characters (diff)
downloadshulker-8099fd7ac494c12860145f021c46326a1c784ea0.tar.gz
shulker-8099fd7ac494c12860145f021c46326a1c784ea0.zip
fallback to bot message if webhook fails
Diffstat (limited to '')
-rw-r--r--src/Discord.ts19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Discord.ts b/src/Discord.ts
index 3a4dab8..8071d7e 100644
--- a/src/Discord.ts
+++ b/src/Discord.ts
@@ -292,17 +292,20 @@ class Discord {
       const webhook = await this.makeDiscordWebhook(username, message)
       try {
         await axios.post(this.config.WEBHOOK_URL, webhook, { headers: { 'Content-Type': 'application/json' } })
+        return
       } catch (e) {
-        console.log('[ERROR] Could not send Discord message through WebHook!')
+        console.log('[ERROR] Could not send Discord message through WebHook! Falling back to sending through bot.')
         if (this.config.DEBUG) console.log(e)
       }
-    } else {
-      try {
-        await this.channel!.send(this.makeDiscordMessage(username, message))
-      } catch (e) {
-        console.log('[ERROR] Could not send Discord message through bot!')
-        process.exit(1)
-      }
+    }
+
+    const messageContent = this.makeDiscordMessage(username, message)
+
+    try {
+      await this.channel!.send(messageContent)
+    } catch (e) {
+      console.log('[ERROR] Could not send Discord message through bot!')
+      process.exit(1)
     }
   }
 }
sations With FriendsJune McEnroe 2022-07-30Add Normal PeopleJune McEnroe 2022-07-26Rewrite glitch from new pngoJune McEnroe 2022-07-26Update Care with 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