From 70b5950fb1fbeafa4aa72e63fbc484d962db4e9c Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Tue, 14 Jul 2020 19:57:10 +0100 Subject: [PATCH] Add different colors for each chat type in discord-chat --- plugins/discord-chat/README.md | 3 ++- plugins/discord-chat/index.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/discord-chat/README.md b/plugins/discord-chat/README.md index ccc3e22..6afae35 100644 --- a/plugins/discord-chat/README.md +++ b/plugins/discord-chat/README.md @@ -25,7 +25,8 @@ await discordChat( 'discordChannelID', { // options - the options included below display the defaults and can be removed for simplicity. ignoreChats: ['ChatSquad', 'ChatAdmin'], // an array of chats to not display. - color: 16761867 // color of embed + color: 16761867, // color of embed + chatColors: { 'ChatAll': 16761867 } // change the color of chat types individually. Defaults to color above if not specified. } ); ``` diff --git a/plugins/discord-chat/index.js b/plugins/discord-chat/index.js index 8735ede..d517994 100644 --- a/plugins/discord-chat/index.js +++ b/plugins/discord-chat/index.js @@ -11,6 +11,9 @@ export default async function(server, discordClient, channelID, options = {}) { const ignoreChats = options.ignoreChats || ['ChatSquad', 'ChatAdmin']; options = { + chatColors: { + ...options.chatColors + }, color: 16761867, ...options }; @@ -25,7 +28,7 @@ export default async function(server, discordClient, channelID, options = {}) { channel.send({ embed: { title: info.chat, - color: options.color, + color: options.chatColors[info.chat] || options.color, fields: [ { name: 'Player',