diff options
author | June McEnroe <june@causal.agency> | 2023-01-14 22:43:07 +0000 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2023-01-14 22:43:07 +0000 |
commit | c78139e8373092136fa7c7decd886b807cfae08c (patch) | |
tree | 02ab3d747890daf72f1c737f8c9c39824020ed3a /src/Shulker.ts | |
parent | Clean up rcon package callbacks (diff) | |
download | shulker-master.tar.gz shulker-master.zip |
Diffstat (limited to 'src/Shulker.ts')
-rw-r--r-- | src/Shulker.ts | 11 |
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() } } |