summary refs log tree commit diff homepage
path: root/src/Shulker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Shulker.ts')
-rw-r--r--src/Shulker.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Shulker.ts b/src/Shulker.ts
index 8f6a5bb..7d3d4a1 100644
--- a/src/Shulker.ts
+++ b/src/Shulker.ts
@@ -2,6 +2,7 @@ import fs from 'fs'
 
 import DiscordClient from './Discord'
 import Handler, { LogLine } from './MinecraftHandler'
+import RTD from './RTD'
 
 import type { Config } from './Config'
 
@@ -13,6 +14,7 @@ class Shulker {
   config: Config
   discordClient: DiscordClient
   handler: Handler
+  rtd: RTD
 
   readonly deprecatedConfigs: OutdatedConfigMessages = {
     'DEATH_KEY_WORDS': '`DEATH_KEY_WORDS` has been replaced with `REGEX_DEATH_MESSAGE`. Please update this from the latest example config.'
@@ -69,7 +71,12 @@ class Shulker {
     this.handler.init(async (data: LogLine) => {
       if (data) {
         const { username, message } = data
-        await this.discordClient.sendMessage(username, message)
+		const rtd = await this.rtd.handle(username, message)
+		if (rtd) {
+			await this.discordClient.sendMessage(rtd.username, rtd.message)
+		} else {
+			await this.discordClient.sendMessage(username, message)
+		}
       }
     })
   }
@@ -80,8 +87,10 @@ class Shulker {
 
     this.discordClient = new DiscordClient(this.config, () => this.onDiscordReady())
     this.handler = new Handler(this.config)
+	this.rtd = new RTD(this.config, this.discordClient)
 
     await this.discordClient.init()
+	await this.rtd.init()
   }
 }