Add different colors for each chat type in discord-chat

This commit is contained in:
Thomas Smyth 2020-07-14 19:57:10 +01:00
parent 2381af93bd
commit 70b5950fb1
2 changed files with 6 additions and 2 deletions

View File

@ -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.
}
);
```

View File

@ -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',