From c78139e8373092136fa7c7decd886b807cfae08c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 14 Jan 2023 22:43:07 +0000 Subject: Add a complete mess of an RTD command --- src/Shulker.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/Shulker.ts') 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() } } -- cgit 1.4.1