summary refs log tree commit diff homepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Config.ts2
-rw-r--r--src/Discord.ts9
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Config.ts b/src/Config.ts
index 5a1417d..ee24698 100644
--- a/src/Config.ts
+++ b/src/Config.ts
@@ -37,6 +37,8 @@ export interface Config {
 
   SERVER_NAME: string
   SERVER_IMAGE: string
+  HEAD_IMAGE_URL: string
+  DEFAULT_PLAYER_HEAD: string
   SHOW_SERVER_STATUS: boolean
   SHOW_PLAYER_CONN_STAT: boolean
   SHOW_PLAYER_ADVANCEMENT: boolean
diff --git a/src/Discord.ts b/src/Discord.ts
index e1a7903..b001c8c 100644
--- a/src/Discord.ts
+++ b/src/Discord.ts
@@ -219,17 +219,22 @@ class Discord {
     }
   }
 
+  private getHeadUrl(uuid: string): string {
+    const url = this.config.HEAD_IMAGE_URL || 'https://minotar.net/helm/%uuid%/256.png'
+    return url.replace(/%uuid%/, uuid)
+  }
+
   private async makeDiscordWebhook (username: string, message: string) {
     message = this.replaceDiscordMentions(message)
 
-    const defaultHead = 'https://minotar.net/helm/c06f89064c8a49119c29ea1dbd1aab82/256.png' // MHF_Steve
+    const defaultHead = this.getHeadUrl(this.config.DEFAULT_PLAYER_HEAD || 'c06f89064c8a49119c29ea1dbd1aab82') // MHF_Steve
 
     let avatarURL
     if (username === this.config.SERVER_NAME + ' - Server') { // use avatar for the server
       avatarURL = this.config.SERVER_IMAGE || defaultHead
     } else { // use avatar for player
       const uuid = await this.getUUIDFromUsername(username)
-      avatarURL = !!uuid ? `https://minotar.net/helm/${uuid}/256.png` : defaultHead
+      avatarURL = !!uuid ? this.getHeadUrl(uuid) : defaultHead
     }
 
     return {