diff options
author | destruc7i0n <6181960+destruc7i0n@users.noreply.github.com> | 2022-01-02 19:28:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 19:28:04 -0500 |
commit | 037deb3ea5c8688762a50b12302d3fc025cf9b3b (patch) | |
tree | b06cc3de5c05228226003a2ae09d762e79bfa75c /src/Shulker.ts | |
parent | cleanup from merge (diff) | |
download | shulker-037deb3ea5c8688762a50b12302d3fc025cf9b3b.tar.gz shulker-037deb3ea5c8688762a50b12302d3fc025cf9b3b.zip |
Webhook updates (#78)
* extracted webhook config, modernized config * updated readme to be more beginner friendly * added config for uuid api url * more readme updates Co-authored-by: destruc7i0n <destruc7i0n@users.noreply.github.com>
Diffstat (limited to 'src/Shulker.ts')
-rw-r--r-- | src/Shulker.ts | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/Shulker.ts b/src/Shulker.ts index 1846def..8f6a5bb 100644 --- a/src/Shulker.ts +++ b/src/Shulker.ts @@ -5,14 +5,22 @@ import Handler, { LogLine } from './MinecraftHandler' import type { Config } from './Config' +interface OutdatedConfigMessages { + [key: string]: string +} + class Shulker { config: Config discordClient: DiscordClient handler: Handler - readonly deprecatedConfigs: string[] = ['DEATH_KEY_WORDS'] + readonly deprecatedConfigs: OutdatedConfigMessages = { + 'DEATH_KEY_WORDS': '`DEATH_KEY_WORDS` has been replaced with `REGEX_DEATH_MESSAGE`. Please update this from the latest example config.' + } - constructor() { + readonly removedConfigs: OutdatedConfigMessages = { + 'DISCORD_CHANNEL_NAME': 'Please remove this config line. Use the channel ID with `DISCORD_CHANNEL_ID` rather than the channel name.', + 'SLASH_COMMAND_ROLES': 'Please use the slash command role IDs with `SLASH_COMMAND_ROLES_IDS` instead.' } loadConfig () { @@ -30,10 +38,22 @@ class Shulker { return false } - for (const option of this.deprecatedConfigs) { - if (this.config.hasOwnProperty(option)) { - console.log('[WARN] Using deprecated config option ' + option + '. Check README.md for current options.') + for (const configKey of Object.keys(this.deprecatedConfigs)) { + if (this.config.hasOwnProperty(configKey)) { + console.log('[WARN] Using deprecated config option ' + configKey + '. Check README.md for current options. These options will be removed in a future release.') + console.log(' ' + this.deprecatedConfigs[configKey]) + } + } + + const hasRemovedConfig = Object.keys(this.config).some(key => Object.keys(this.removedConfigs).includes(key)) + if (hasRemovedConfig) { + for (const configKey of Object.keys(this.removedConfigs)) { + if (this.config.hasOwnProperty(configKey)) { + console.log('[ERROR] Using removed config option ' + configKey + '. Check README.md for current options.') + console.log(' ' + this.removedConfigs[configKey]) + } } + process.exit(1) } if (this.config.USE_WEBHOOKS) { |