diff options
Diffstat (limited to '')
-rw-r--r-- | README.md | 62 | ||||
-rw-r--r-- | config.example.json | 9 | ||||
-rw-r--r-- | src/Config.ts | 5 | ||||
-rw-r--r-- | src/Discord.ts | 113 | ||||
-rw-r--r-- | src/DiscordWebhooks.ts | 112 | ||||
-rw-r--r-- | src/Shulker.ts | 30 |
6 files changed, 202 insertions, 129 deletions
diff --git a/README.md b/README.md index 08594dd..ba789ef 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,16 @@ ![discord-mc](http://i.thedestruc7i0n.ca/I5anbg.gif) ## Features -- Sends message to and from Vanilla Minecraft servers -- Can send messages regarding advancements, when players join and leave, and player deaths +- Sends message to and from Vanilla Minecraft servers with no plugins or mods +- Can send messages regarding + - Advancements + - Players joining and leaving + - Player deaths +- Webhooks for sending messages +- Allows members with specific roles to send commands to Minecraft through Discord - Can be run on a remote machine or locally on the same machine (see `IS_LOCAL_FILE` in the options below) -- Allows admins to send commands to Minecraft through Discord -## Installation and usage +## Installation Ensure you have Node v16.6+ installed. You can check the version you have installed with `node -v` in your terminal or command prompt. @@ -29,27 +33,32 @@ rcon.password=<your password> rcon.port=<1-65535> ``` -Clone repository onto a server, copy ```config.example.json``` to ```config.json```, and edit it to enter your Discord bot details and to change any options (see below for details on the config file). +Clone this repository onto a server, copy ```config.example.json``` to ```config.json```. And edit the following config fields: -Then, in the repository folder: -```sh -yarn # or npm install -yarn build # or npm run build -yarn start # or npm run start -``` +Set `DISCORD_TOKEN` to the Discord Bot token that you created. -If you are running this on the same server as the MC server, enable the `IS_LOCAL_FILE` flag and update related options below. -Otherwise, perform the following command on the server hosting (in a screen/tmux session or background process, make sure to replace your `YOUR_URL` with whatever URL you're using (`localhost:8000` if running on the same server and default config) and `PATH_TO_MINECRAFT_SERVER_INSTALL` with the path to the Minecraft server installation, such as `/usr/home/minecraft_server/`): +Set `MINECRAFT_SERVER_RCON_IP`, `MINECRAFT_SERVER_RCON_PORT`, and `MINECRAFT_SERVER_RCON_PASSWORD` to the ip, rcon port, and rcon password respectively for your server. (127.0.0.1 can be used if Shulker is running on the same server as your Minecraft server) -``` sh -tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered ": <" | while read x ; do echo -ne $x | curl -X POST -d @- http://YOUR_URL/minecraft/hook ; done +If you are running Shulker on the same server as your Minecraft server, set `IS_LOCAL_FILE` to `true` and update `LOCAL_FILE_PATH` to the full path to your Minecraft server's latest log file. (ex: `minecraft_server/logs/latest.log`) + +If you want to have Shulker running on a remote server, see [Remote](#remote-setup) below. + +With developer mode (Settings > Appearance > Developer Mode) enabled, right click the channel you wish to have Shulker send messages to and click "Copy ID". Set `DISCORD_CHANNEL_ID` to this value. + +Create a webhook in the channel (Right click on channel > Edit Channel > Integrations > Create Webhook or New Webhook), copy it, and set `WEBHOOK_URL` to this value. + +Finally, start Shulker. +```sh +npm install +npm run build +npm run start ``` -(The above command will also be given to you if you are not using a local file when you first start up Shulker) ### Configuration +Details on the `config.json` file. + ```js { - "PORT": 8000, /* Port you want to run the webserver for the hook on */ "DEBUG": false, /* Dev debugging */ "USE_WEBHOOKS": true, /* If you want to use webhooks rather than the Discord bot sending the messages (recommended) */ @@ -59,7 +68,6 @@ tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered "DISCORD_TOKEN": "<12345>", /* Discord bot token. [Click here](https://discordapp.com/developers/applications/me) to create you application and add a bot to it. */ "DISCORD_CHANNEL_ID": "<channel>", /* Discord channel ID for for the discord bot. Enable developer mode in your Discord client, then right click channel and select "Copy ID". */ - "DISCORD_CHANNEL_NAME": "#<channel name>" /* The Discord channel name. It is recommended to use the ID if the bot is in multiple servers. The ID will take precedence. */ "DISCORD_MESSAGE_TEMPLATE": "`%username%`:%message%", /* Message template to display in Discord */ "MINECRAFT_SERVER_RCON_IP": "127.0.0.1", /* Minecraft server IP (make sure you have enabled rcon) */ @@ -73,12 +81,13 @@ tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered "LOCAL_FILE_PATH": "/usr/home/minecraft_server/logs/latest.log", /* the path to the local file if `IS_LOCAL_FILE` is set */ "FS_WATCH_FILE": false, /* use node's watchFile rather than watch. see FAQ for more details */ + "PORT": 8000, /* Port you want to run the webserver for the hook on */ "SHOW_INIT_MESSAGE": true, /* Sends the message on boot if not a local file of what command to run */ "ALLOW_USER_MENTIONS": false, /* should replace @mentions with the mention in discord (format: @username#discriminator) */ "ALLOW_HERE_EVERYONE_MENTIONS": false, /* replaces @everyone and @here with "@ everyone" and "@ here" respectively */ "ALLOW_SLASH_COMMANDS": false, /* whether to allow users to run slash commands from discord */ - "SLASH_COMMAND_ROLES": [], /* if the above is enabled, the names of the roles which can run slash commands */ + "SLASH_COMMAND_ROLES_IDS": [], /* if the above is enabled, the IDs of the roles which can run slash commands. With developer mode enabled, right click each role and "Copy ID". */. "WEBHOOK": "/minecraft/hook", /* Web hook, where to send the log to */ "REGEX_SERVER_PREFIX": "\\[Server thread/INFO\\]:", /* What the lines of the log should start with */ @@ -89,7 +98,9 @@ tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered "SERVER_NAME": "Shulker", /* The username used when displaying any server information in chat, e.g., Server - Shulker : Server message here*/ "SERVER_IMAGE": "", /* Image for the server when sending such messages (if enabled below). Only for WebHooks. */ "HEAD_IMAGE_URL": "https://mc-heads.net/avatar/%uuid%/256", /* Url to get the heads for the webhook, %uuid% is replaced with the uuid of the player */ + "UUID_API_URL": "https://api.mojang.com/users/profiles/minecraft/%username%", /* Url to fetch the uuids from. %username% is replaced with the username of the player. expects uuid at top level key `id` (like the mojang api) */ "DEFAULT_PLAYER_HEAD": "c06f89064c8a49119c29ea1dbd1aab82", /* UUID of player with the default head to use (currently is MHF_Steve) */ + "SHOW_SERVER_STATUS": false, /* Shows when the server turns on and off e.g., Server - Shulker : Server is online */ "SHOW_PLAYER_CONN_STAT": false, /* Shows player connection status in chat, e.g., Server - Shulker : TheMachine joined the game */ "SHOW_PLAYER_ADVANCEMENT": false, /* Shows when players earn advancements in chat, e.g., Server - Shulker : TheMachine has made the advacement [MEME - Machine] */ @@ -103,13 +114,22 @@ tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered - Try replacing `REGEX_SERVER_PREFIX` with `"\\[Server thread/INFO\\] \\[.*\\]:"` * Why can't I send commands even if I have the option enabled? - - Make sure that you have a role on the server which is put in the array `SLASH_COMMAND_ROLES` case-sensitive. - - e.g. `"SLASH_COMMAND_ROLES": ["Admin"]` + - Make sure that you have a role on the server which is put in the array `SLASH_COMMAND_ROLES_IDS`. + - e.g. `"SLASH_COMMAND_ROLES_IDS": ["<role id>"]` * I am using a local file and no messages are being sent! - Enable `DEBUG` in the config to check for any errors. - If you are on Windows, try enabling `FS_WATCH_FILE`. +## Remote Setup + +Perform the following command on the server hosting the Minecraft server (in a screen/tmux session or background process, make sure to replace your `YOUR_URL` with whatever URL you're using (`localhost:8000` if running on the same server and default config) and `PATH_TO_MINECRAFT_SERVER_INSTALL` with the path to the Minecraft server installation, such as `/usr/home/minecraft_server/`): + +```sh +tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered ": <" | while read x ; do echo -ne $x | curl -X POST -d @- http://YOUR_URL/minecraft/hook ; done +``` +(The above command will also be given to you if you are not using a local file when you first start up Shulker) + ## Upgrade Instructions From version 2 to version 3: - The main change is that you need to split your `REGEX_MATCH_CHAT_MC` to both `REGEX_MATCH_CHAT_MC` and `REGEX_SERVER_PREFIX`. diff --git a/config.example.json b/config.example.json index 4225ff4..3b49203 100644 --- a/config.example.json +++ b/config.example.json @@ -1,5 +1,4 @@ { - "PORT": 8000, "DEBUG": false, "USE_WEBHOOKS": true, @@ -7,13 +6,12 @@ "IGNORE_WEBHOOKS": true, "DISCORD_TOKEN": "TOKEN_HERE", "DISCORD_CHANNEL_ID": "", - "DISCORD_CHANNEL_NAME": "#bot", "DISCORD_MESSAGE_TEMPLATE": "`%username%`: %message%", "MINECRAFT_SERVER_RCON_IP": "127.0.0.1", "MINECRAFT_SERVER_RCON_PORT": 25575, "MINECRAFT_SERVER_RCON_PASSWORD": "password", - "MINECRAFT_TELLRAW_TEMPLATE": "[{\"color\": \"white\", \"text\": \"<%username%> %message%\"}]", + "MINECRAFT_TELLRAW_TEMPLATE": "[{\"color\": \"white\", \"text\": \"<@%username%> %message%\"}]", "MINECRAFT_TELLRAW_DOESNT_EXIST": false, "MINECRAFT_TELLRAW_DOESNT_EXIST_SAY_TEMPLATE": "<%username%> %message%", @@ -21,12 +19,13 @@ "LOCAL_FILE_PATH": "/usr/home/minecraft_server/logs/latest.log", "FS_WATCH_FILE": false, + "PORT": 8000, "SHOW_INIT_MESSAGE": true, "ALLOW_USER_MENTIONS": false, "ALLOW_HERE_EVERYONE_MENTIONS": false, "ALLOW_SLASH_COMMANDS": false, - "SLASH_COMMAND_ROLES": [], + "SLASH_COMMAND_ROLES_IDS": [], "WEBHOOK": "/minecraft/hook", "REGEX_SERVER_PREFIX": "\\[Server thread/INFO\\]:", @@ -37,7 +36,9 @@ "SERVER_NAME": "Shulker", "SERVER_IMAGE": "", "HEAD_IMAGE_URL": "https://mc-heads.net/avatar/%uuid%/256", + "UUID_API_URL": "https://api.mojang.com/users/profiles/minecraft/%username%", "DEFAULT_PLAYER_HEAD": "c06f89064c8a49119c29ea1dbd1aab82", + "SHOW_SERVER_STATUS": false, "SHOW_PLAYER_CONN_STAT": false, "SHOW_PLAYER_ADVANCEMENT": false, diff --git a/src/Config.ts b/src/Config.ts index 485d6ae..8b18aa7 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -7,7 +7,6 @@ export interface Config { IGNORE_WEBHOOKS: string DISCORD_TOKEN: string DISCORD_CHANNEL_ID: string - DISCORD_CHANNEL_NAME: string DISCORD_MESSAGE_TEMPLATE: string MINECRAFT_SERVER_RCON_IP: string @@ -29,7 +28,7 @@ export interface Config { ALLOW_USER_MENTIONS: boolean ALLOW_HERE_EVERYONE_MENTIONS: boolean ALLOW_SLASH_COMMANDS: boolean - SLASH_COMMAND_ROLES: string[] + SLASH_COMMAND_ROLES_IDS: string[] WEBHOOK: string REGEX_SERVER_PREFIX: string @@ -40,7 +39,9 @@ export interface Config { SERVER_NAME: string SERVER_IMAGE: string HEAD_IMAGE_URL: string + UUID_API_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 8071d7e..087619b 100644 --- a/src/Discord.ts +++ b/src/Discord.ts @@ -1,20 +1,20 @@ import { Client, Intents, Message, TextChannel, User } from 'discord.js' import emojiStrip from 'emoji-strip' -import axios from 'axios' import type { Config } from './Config' import Rcon from './Rcon' +import DiscordWebhooks from './DiscordWebhooks' import { escapeUnicode } from './lib/util' class Discord { config: Config client: Client + webhookClient: DiscordWebhooks | null channel: TextChannel | null - uuidCache: Map<string, string> mentionCache: Map<string, User> constructor (config: Config, onReady?: () => void) { @@ -24,9 +24,10 @@ class Discord { if (onReady) this.client.once('ready', () => onReady()) this.client.on('messageCreate', (message: Message) => this.onMessage(message)) + this.webhookClient = null + this.channel = null - this.uuidCache = new Map() this.mentionCache = new Map() } @@ -39,9 +40,12 @@ class Discord { process.exit(1) } - if (this.config.DISCORD_CHANNEL_NAME && !this.config.DISCORD_CHANNEL_ID) { - await this.getChannelIdFromName(this.config.DISCORD_CHANNEL_NAME) - } else if (this.config.DISCORD_CHANNEL_ID) { + if (this.config.USE_WEBHOOKS) { + this.webhookClient = new DiscordWebhooks(this.config) + this.webhookClient.init() + } + + if (this.config.DISCORD_CHANNEL_ID) { const channel = await this.client.channels.fetch(this.config.DISCORD_CHANNEL_ID) as TextChannel if (!channel) { console.log(`[INFO] Could not find channel with ID ${this.config.DISCORD_CHANNEL_ID}. Please check that the ID is correct and that the bot has access to it.`) @@ -55,45 +59,6 @@ class Discord { } } - private async getChannelIdFromName (name: string) { - // remove the # if there is one - if (name.startsWith('#')) name = name.substring(1, name.length) - - // fetch all the channels in every server - for (const guild of this.client.guilds.cache.values()) { - await guild.channels.fetch() - } - - const channel = this.client.channels.cache.find((c) => c.isText() && c.type === 'GUILD_TEXT' && c.name === name && !c.deleted) - if (channel) { - this.channel = channel as TextChannel - } else { - console.log(`[INFO] Could not find channel ${name}! Check that the name is correct or use the ID of the channel instead (DISCORD_CHANNEL_ID)!`) - process.exit(1) - } - } - - private parseDiscordWebhook (url: string) { - const re = /discord[app]?.com\/api\/webhooks\/([^\/]+)\/([^\/]+)/ - - // the is of the webhook - let id = null - let token = null - - if (!re.test(url)) { - // In case the url changes at some point, I will warn if it still works - console.log('[WARN] The Webhook URL may not be valid!') - } else { - const match = url.match(re) - if (match) { - id = match[1] - token = match[2] - } - } - - return { id, token } - } - private async onMessage (message: Message) { // no channel, done if (!this.channel) return @@ -109,8 +74,7 @@ class Discord { return } else if (this.config.USE_WEBHOOKS) { // otherwise, ignore all webhooks that are not the same as this one - const { id } = this.parseDiscordWebhook(this.config.WEBHOOK_URL) - if (id === message.webhookId) { + if (this.webhookClient!.id === message.webhookId) { if (this.config.DEBUG) console.log('[INFO] Ignoring webhook from self') return } @@ -134,8 +98,8 @@ class Discord { } let command: string | undefined; - if (this.config.ALLOW_SLASH_COMMANDS && this.config.SLASH_COMMAND_ROLES && message.cleanContent.startsWith('/') && message.member) { - const hasSlashCommandRole = message.member.roles.cache.find(r => this.config.SLASH_COMMAND_ROLES.includes(r.name)) + if (this.config.ALLOW_SLASH_COMMANDS && this.config.SLASH_COMMAND_ROLES_IDS && message.cleanContent.startsWith('/') && message.member) { + const hasSlashCommandRole = this.config.SLASH_COMMAND_ROLES_IDS.some(id => message.member?.roles.cache.get(id)) if (hasSlashCommandRole) { // send the raw command, can be dangerous... command = message.cleanContent @@ -164,7 +128,7 @@ class Discord { if (response?.startsWith('Unknown command') || response?.startsWith('Unknown or incomplete command')) { console.log('[ERROR] Could not send command! (Unknown command)') if (command.startsWith('/tellraw')) { - console.log('Your Minecraft version may not support tellraw, please look into MINECRAFT_TELLRAW_DOESNT_EXIST!') + console.log('[INFO] Your Minecraft version may not support tellraw, please check MINECRAFT_TELLRAW_DOESNT_EXIST in the README') } } } @@ -240,45 +204,6 @@ class Discord { return message } - private async getUUIDFromUsername (username: string): Promise<string | null> { - username = username.toLowerCase() - if (this.uuidCache.has(username)) return this.uuidCache.get(username)! - // otherwise fetch and store - try { - const response = await (await axios.get('https://api.mojang.com/users/profiles/minecraft/' + username)).data - const uuid = response.id - this.uuidCache.set(username, uuid) - if (this.config.DEBUG) console.log(`[DEBUG] Fetched UUID ${uuid} for username "${username}"`) - return uuid - } catch (e) { - console.log(`[ERROR] Could not fetch uuid for ${username}, falling back to Steve for the skin`) - return null - } - } - - private getHeadUrl(uuid: string): string { - const url = this.config.HEAD_IMAGE_URL || 'https://mc-heads.net/avatar/%uuid%/256' - return url.replace(/%uuid%/, uuid) - } - - private async makeDiscordWebhook (username: string, message: string) { - 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 ? this.getHeadUrl(uuid) : defaultHead - } - - return { - username, - content: message, - 'avatar_url': avatarURL, - } - } - private makeDiscordMessage(username: string, message: string) { return this.config.DISCORD_MESSAGE_TEMPLATE .replace('%username%', username) @@ -289,14 +214,8 @@ class Discord { message = await this.replaceDiscordMentions(message) if (this.config.USE_WEBHOOKS) { - const webhook = await this.makeDiscordWebhook(username, message) - try { - await axios.post(this.config.WEBHOOK_URL, webhook, { headers: { 'Content-Type': 'application/json' } }) - return - } catch (e) { - console.log('[ERROR] Could not send Discord message through WebHook! Falling back to sending through bot.') - if (this.config.DEBUG) console.log(e) - } + const sentMessage = await this.webhookClient!.sendMessage(username, message) + if (sentMessage) return } const messageContent = this.makeDiscordMessage(username, message) diff --git a/src/DiscordWebhooks.ts b/src/DiscordWebhooks.ts new file mode 100644 index 0000000..fcdf57f --- /dev/null +++ b/src/DiscordWebhooks.ts @@ -0,0 +1,112 @@ +import { WebhookClient, WebhookMessageOptions } from 'discord.js' + +import axios from 'axios' + +import type { Config } from './Config' + +class DiscordWebhooks { + private config: Config + + private webhookClient: WebhookClient + + private uuidCache: Map<string, string> + + public id: string | null + private token: string | null + + constructor (config: Config) { + this.config = config + + this.id = null + this.token = null + + this.uuidCache = new Map() + } + + public init () { + const { id, token } = this.parseDiscordWebhook(this.config.WEBHOOK_URL) + + if (!id || !token) { + process.exit(1) + } + + this.id = id + this.token = token + + this.webhookClient = new WebhookClient({ id, token }) + } + + private parseDiscordWebhook (url: string) { + const re = /discord[app]?.com\/api\/webhooks\/([^\/]+)\/([^\/]+)/ + + // the is of the webhook + let id = null + let token = null + + if (!re.test(url)) { + // In case the url changes at some point, I will warn if it still works + console.log('[WARN] The Webhook URL may not be valid!') + } else { + const match = url.match(re) + id = match?.[1] + token = match?.[2] + } + + return { id, token } + } + + private async getUUIDFromUsername (username: string): Promise<string | null> { + username = username.toLowerCase() + if (this.uuidCache.has(username)) return this.uuidCache.get(username)! + // otherwise fetch and store + try { + const response = await ( + await axios.get((this.config.UUID_API_URL ?? 'https://api.mojang.com/users/profiles/minecraft/%username%').replace('%username%', username)) + ).data + const uuid = response.id + this.uuidCache.set(username, uuid) + if (this.config.DEBUG) console.log(`[DEBUG] Fetched UUID ${uuid} for username "${username}"`) + return uuid + } catch (e) { + console.log(`[ERROR] Could not fetch uuid for ${username}, falling back to Steve for the skin`) + return null + } + } + + private getHeadUrl(uuid: string): string { + const url = this.config.HEAD_IMAGE_URL || 'https://mc-heads.net/avatar/%uuid%/256' + return url.replace(/%uuid%/, uuid) + } + + private async makeDiscordWebhook (username: string, message: string) { + const defaultHead = this.getHeadUrl(this.config.DEFAULT_PLAYER_HEAD || 'c06f89064c8a49119c29ea1dbd1aab82') // MHF_Steve + + const messsageOptions: WebhookMessageOptions = { + username, + content: message, + } + + if (username === this.config.SERVER_NAME + ' - Server') { // use avatar for the server + if (this.config.SERVER_IMAGE) messsageOptions.avatarURL = this.config.SERVER_IMAGE + } else { // use avatar for player + const uuid = await this.getUUIDFromUsername(username) + messsageOptions.avatarURL = !!uuid ? this.getHeadUrl(uuid) : defaultHead + } + + return messsageOptions + } + + public async sendMessage (username: string, message: string) { + const webhookContent = await this.makeDiscordWebhook(username, message) + try { + await this.webhookClient!.send(webhookContent) + return true + } catch (e) { + console.log('[ERROR] Could not send Discord message through WebHook! Falling back to sending through bot.') + if (this.config.DEBUG) console.log(e) + return false + } + } +} + +export default DiscordWebhooks 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) { |