From 3d78ff78040b787423d80345602fb2502129f2e8 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 14:59:34 -0500 Subject: [PATCH 01/16] adding embeds --- src/embeds/ConstructionEmbed.js | 29 +++++++++++ src/embeds/EventEmbed.js | 91 ++++++++++++--------------------- 2 files changed, 63 insertions(+), 57 deletions(-) create mode 100644 src/embeds/ConstructionEmbed.js diff --git a/src/embeds/ConstructionEmbed.js b/src/embeds/ConstructionEmbed.js new file mode 100644 index 000000000..576d59394 --- /dev/null +++ b/src/embeds/ConstructionEmbed.js @@ -0,0 +1,29 @@ +'use strict'; + +const BaseEmbed = require('./BaseEmbed.js'); + +/** + * Generates daily deal embeds + */ +class ConstructionEmbed extends BaseEmbed { + /** + * @param {Genesis} bot - An instance of Genesis + * @param {Construction} constructionProgress - The current construction information + * @param {string} platform - The platform the event is for + */ + constructor(bot, constructionProgress, platform) { + super(); + + this.color = 0xff6961; + this.fields = [{ + name: `[${platform}] Construction Status:`, + value: '```' + + `Razorback: ${construction.razorbackProgress}` + + `Fomorian: ${construction.fomorianProgress}` + + `Unknown: ${construction.unknwonProgress}` + + '```' + }]; + } +} + +module.exports = ConstructionEmbed; diff --git a/src/embeds/EventEmbed.js b/src/embeds/EventEmbed.js index 0b8ba47ac..2d9b069bd 100644 --- a/src/embeds/EventEmbed.js +++ b/src/embeds/EventEmbed.js @@ -1,57 +1,34 @@ -'use strict'; - -const BaseEmbed = require('./BaseEmbed.js'); - -/** - * Generates fissure embeds - */ -class EventEmbed extends BaseEmbed { - /** - * @param {Genesis} bot - An instance of Genesis - * @param {Array.} events - The fissures to be included in the embed - */ - constructor(bot, events) { - super(); - - if (events.length < 2) { - this.title = 'Worldstate - Events'; - this.description = 'Events'; - } - - if (events.length > 1) { - this.fields = events.map(e => ({ - name: `${e.description}`, - value: `Takes place on: ${e.concurrentNodes.join(', ')}\nRewards: ${e.rewards.join(', ')}`, - })); - } else if (events.length === 0) { - this.fields = { - name: 'Currently no events', - value: '_ _', - }; - } else { - const e = events[0]; - this.title = 'Event! '; - this.description = `${e.description} against ${e.faction}`; - this.fields = [ - { - name: 'Rewards', - value: e.rewards.join('\n'), - inline: true, - }, - { - name: 'Nodes', - value: `${e.concurrentNodes.join('\n')}\n${e.node ? e.node : ''}\n${e.victimNode ? e.victimNode : ''}`, - inline: true, - }, - ]; - this.footer.text = e.toolTip ? e.toolTip : this.footer.text; - } - - this.color = events.length > 2 ? 0x00ff00 : 0xff0000; - this.thumbnail = { - url: 'https://i.imgur.com/EfIRu6v.png', - }; - } -} - -module.exports = EventEmbed; +'use strict'; + +const BaseEmbed = require('./BaseEmbed.js'); + +/** + * Generates daily deal embeds + */ +class EventEmbed extends BaseEmbed { + /** + * @param {Genesis} bot - An instance of Genesis + * @param {Event} event - The deal to be included in the embed + * @param {string} platform - The platform the event is for + */ + constructor(bot, event, platform) { + super(); + + this.color = 0xfdec96; + + if (event) { + this.title = `[${platform}] ${event.description}`; + this.fields = []; + + if (event.victimNode) { + this.fields.push({name: '_ _', value: `Defend ${event.victimNode} by attacking the ${event.faction} at ${event.node}.` }); + } + this.fields.push({ name: 'Rewards', value: event.rewards.map(reward => reward.asString).join('; ') }); + this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) }); + } else { + this.title = 'No Current Events'; + } + } +} + +module.exports = EventEmbed; From d5499f2f05080b0e3b713e7966637267f452a3f0 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:00:53 -0500 Subject: [PATCH 02/16] Add commands for previously added embeds --- src/commands/Worldstate/Construction.js | 28 +++++++++++++++++++ src/commands/Worldstate/Event.js | 36 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 src/commands/Worldstate/Construction.js create mode 100644 src/commands/Worldstate/Event.js diff --git a/src/commands/Worldstate/Construction.js b/src/commands/Worldstate/Construction.js new file mode 100644 index 000000000..e37807e2e --- /dev/null +++ b/src/commands/Worldstate/Construction.js @@ -0,0 +1,28 @@ +'use strict'; + +const Command = require('../../Command.js'); +const EventEmbed = require('../../embeds/ConstructionEmbed.js'); + +/** + * Displays the current simaris target + */ +class Construction extends Command { + /** + * Constructs a callable command + * @param {Genesis} bot The bot object + */ + constructor(bot) { + super(bot, 'warframe.worldstate.construction', 'construction', 'Display current construction progress.'); + this.regex = new RegExp(`^${this.call}(?:\\s+on\\s+([pcsxb14]{2,3}))?$`, 'i'); + } + + async run(message) { + const platformParam = message.strippedContent.match(this.regex)[1]; + const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); + const ws = await this.bot.caches[platform].getDataJson(); + await this.messageManager.embed(message, new EventEmbed(this.bot, ws.constructionProgress, platform.toUpperCase()), true, true)); + return this.messageManager.statuses.SUCCESS; + } +} + +module.exports = Construction; diff --git a/src/commands/Worldstate/Event.js b/src/commands/Worldstate/Event.js new file mode 100644 index 000000000..ba62bf4d2 --- /dev/null +++ b/src/commands/Worldstate/Event.js @@ -0,0 +1,36 @@ +'use strict'; + +const Command = require('../../Command.js'); +const EventEmbed = require('../../embeds/EventEmbed.js'); + +/** + * Displays the current event statuses + */ +class Event extends Command { + /** + * Constructs a callable command + * @param {Genesis} bot The bot object + */ + constructor(bot) { + super(bot, 'warframe.worldstate.events', 'events', 'Display current events.'); + this.regex = new RegExp(`^${this.call}(?:\\s+on\\s+([pcsxb14]{2,3}))?$`, 'i'); + } + + async run(message) { + const platformParam = message.strippedContent.match(this.regex)[1]; + const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); + const ws = await this.bot.caches[platform].getDataJson(); + if (ws.events.length > 0) { + const results = []; + ws.events.forEach(event => { + results.push(this.messageManager.embed(message, new EventEmbed(this.bot, event, platform.toUpperCase()), true, true)); + }); + await Promise.all(results); + return this.messageManager.statuses.SUCCESS; + } + await this.messageManager.embed(message, new EventEmbed(this.bot, undefined, platform.toUpperCase()), true, true)); + return this.messageManager.statuses.FAILURE; + } +} + +module.exports = Event; From b61d0cd7e19d536bd9f6465aa41c4bc4d19702a0 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:03:08 -0500 Subject: [PATCH 03/16] fix bad parentheses --- src/commands/Worldstate/Construction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/Worldstate/Construction.js b/src/commands/Worldstate/Construction.js index e37807e2e..3f1a28614 100644 --- a/src/commands/Worldstate/Construction.js +++ b/src/commands/Worldstate/Construction.js @@ -20,7 +20,7 @@ class Construction extends Command { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); const ws = await this.bot.caches[platform].getDataJson(); - await this.messageManager.embed(message, new EventEmbed(this.bot, ws.constructionProgress, platform.toUpperCase()), true, true)); + await this.messageManager.embed(message, new EventEmbed(this.bot, ws.constructionProgress, platform.toUpperCase()), true, true); return this.messageManager.statuses.SUCCESS; } } From 7b7cda0e8a498c4fb253745f29e8c2c51037a9f9 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:04:18 -0500 Subject: [PATCH 04/16] fix parens --- src/commands/Worldstate/Event.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/Worldstate/Event.js b/src/commands/Worldstate/Event.js index ba62bf4d2..a6246ef15 100644 --- a/src/commands/Worldstate/Event.js +++ b/src/commands/Worldstate/Event.js @@ -28,7 +28,7 @@ class Event extends Command { await Promise.all(results); return this.messageManager.statuses.SUCCESS; } - await this.messageManager.embed(message, new EventEmbed(this.bot, undefined, platform.toUpperCase()), true, true)); + await this.messageManager.embed(message, new EventEmbed(this.bot, undefined, platform.toUpperCase()), true, true); return this.messageManager.statuses.FAILURE; } } From dd10bd2969c8161df1d19ed02944593dd053961d Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:04:37 -0500 Subject: [PATCH 05/16] fix indents --- src/embeds/ConstructionEmbed.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/embeds/ConstructionEmbed.js b/src/embeds/ConstructionEmbed.js index 576d59394..570b6d0bc 100644 --- a/src/embeds/ConstructionEmbed.js +++ b/src/embeds/ConstructionEmbed.js @@ -16,12 +16,12 @@ class ConstructionEmbed extends BaseEmbed { this.color = 0xff6961; this.fields = [{ - name: `[${platform}] Construction Status:`, - value: '```' + - `Razorback: ${construction.razorbackProgress}` + - `Fomorian: ${construction.fomorianProgress}` + - `Unknown: ${construction.unknwonProgress}` + - '```' + name: `[${platform}] Construction Status:`, + value: '```' + + `Razorback: ${construction.razorbackProgress}` + + `Fomorian: ${construction.fomorianProgress}` + + `Unknown: ${construction.unknwonProgress}` + + '```' }]; } } From cb6b80c5a53e043d20bc346aa744d49f7f3caf8b Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:05:01 -0500 Subject: [PATCH 06/16] fix indents --- src/embeds/EventEmbed.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/embeds/EventEmbed.js b/src/embeds/EventEmbed.js index 2d9b069bd..1fb112424 100644 --- a/src/embeds/EventEmbed.js +++ b/src/embeds/EventEmbed.js @@ -17,16 +17,16 @@ class EventEmbed extends BaseEmbed { this.color = 0xfdec96; if (event) { - this.title = `[${platform}] ${event.description}`; - this.fields = []; + this.title = `[${platform}] ${event.description}`; + this.fields = []; - if (event.victimNode) { - this.fields.push({name: '_ _', value: `Defend ${event.victimNode} by attacking the ${event.faction} at ${event.node}.` }); - } - this.fields.push({ name: 'Rewards', value: event.rewards.map(reward => reward.asString).join('; ') }); - this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) }); + if (event.victimNode) { + this.fields.push({name: '_ _', value: `Defend ${event.victimNode} by attacking the ${event.faction} at ${event.node}.` }); + } + this.fields.push({ name: 'Rewards', value: event.rewards.map(reward => reward.asString).join('; ') }); + this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) }); } else { - this.title = 'No Current Events'; + this.title = 'No Current Events'; } } } From 658e157475b83b060142e50ad02a37c72aa8c728 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:05:46 -0500 Subject: [PATCH 07/16] fix comma and syntax (construction didn't exist) --- src/embeds/ConstructionEmbed.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/embeds/ConstructionEmbed.js b/src/embeds/ConstructionEmbed.js index 570b6d0bc..b59d7376f 100644 --- a/src/embeds/ConstructionEmbed.js +++ b/src/embeds/ConstructionEmbed.js @@ -18,10 +18,10 @@ class ConstructionEmbed extends BaseEmbed { this.fields = [{ name: `[${platform}] Construction Status:`, value: '```' + - `Razorback: ${construction.razorbackProgress}` + - `Fomorian: ${construction.fomorianProgress}` + - `Unknown: ${construction.unknwonProgress}` + - '```' + `Razorback: ${constructionProgress.razorbackProgress}` + + `Fomorian: ${constructionProgress.fomorianProgress}` + + `Unknown: ${constructionProgress.unknwonProgress}` + + '```', }]; } } From fde711a9c1f6c80bff6d41cef6ea692a1710f12f Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:07:09 -0500 Subject: [PATCH 08/16] fix some indents and line length --- src/commands/Worldstate/Event.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/commands/Worldstate/Event.js b/src/commands/Worldstate/Event.js index a6246ef15..9724746ca 100644 --- a/src/commands/Worldstate/Event.js +++ b/src/commands/Worldstate/Event.js @@ -18,17 +18,20 @@ class Event extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; - const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); + const platform = platformParam || await this.bot.settings + .getChannelSetting(message.channel, 'platform'); const ws = await this.bot.caches[platform].getDataJson(); if (ws.events.length > 0) { - const results = []; - ws.events.forEach(event => { - results.push(this.messageManager.embed(message, new EventEmbed(this.bot, event, platform.toUpperCase()), true, true)); - }); - await Promise.all(results); - return this.messageManager.statuses.SUCCESS; + const results = []; + ws.events.forEach(event => { + results.push(this.messageManager.embed(message, + new EventEmbed(this.bot, event, platform.toUpperCase()), true, true)); + }); + await Promise.all(results); + return this.messageManager.statuses.SUCCESS; } - await this.messageManager.embed(message, new EventEmbed(this.bot, undefined, platform.toUpperCase()), true, true); + await this.messageManager.embed(message, new EventEmbed(this.bot, + undefined, platform.toUpperCase()), true, true); return this.messageManager.statuses.FAILURE; } } From d8e0f4b5602e8ce38f717b1a07d2cf755ce9bf07 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:07:52 -0500 Subject: [PATCH 09/16] fix line length --- src/commands/Worldstate/Construction.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/Worldstate/Construction.js b/src/commands/Worldstate/Construction.js index 3f1a28614..3c0f4c3b0 100644 --- a/src/commands/Worldstate/Construction.js +++ b/src/commands/Worldstate/Construction.js @@ -18,9 +18,11 @@ class Construction extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; - const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); + const platform = platformParam || await this.bot.settings + .getChannelSetting(message.channel, 'platform'); const ws = await this.bot.caches[platform].getDataJson(); - await this.messageManager.embed(message, new EventEmbed(this.bot, ws.constructionProgress, platform.toUpperCase()), true, true); + await this.messageManager.embed(message, new EventEmbed(this.bot, + ws.constructionProgress, platform.toUpperCase()), true, true); return this.messageManager.statuses.SUCCESS; } } From bb1b8d1cb40f61dd59442cd3a6c086a85d39aef2 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:08:49 -0500 Subject: [PATCH 10/16] fix line length --- src/embeds/EventEmbed.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/embeds/EventEmbed.js b/src/embeds/EventEmbed.js index 1fb112424..14588e735 100644 --- a/src/embeds/EventEmbed.js +++ b/src/embeds/EventEmbed.js @@ -21,7 +21,8 @@ class EventEmbed extends BaseEmbed { this.fields = []; if (event.victimNode) { - this.fields.push({name: '_ _', value: `Defend ${event.victimNode} by attacking the ${event.faction} at ${event.node}.` }); + this.fields.push({ name: '_ _', value: `Defend ${event.victimNode}` + + ` by attacking the ${event.faction} at ${event.node}.` }); } this.fields.push({ name: 'Rewards', value: event.rewards.map(reward => reward.asString).join('; ') }); this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) }); From bc88b3dd030ef5812152a118161206bb80909f15 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:10:09 -0500 Subject: [PATCH 11/16] stickler fixes --- src/commands/Worldstate/Event.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/Worldstate/Event.js b/src/commands/Worldstate/Event.js index 9724746ca..f0c11c98f 100644 --- a/src/commands/Worldstate/Event.js +++ b/src/commands/Worldstate/Event.js @@ -23,14 +23,14 @@ class Event extends Command { const ws = await this.bot.caches[platform].getDataJson(); if (ws.events.length > 0) { const results = []; - ws.events.forEach(event => { - results.push(this.messageManager.embed(message, + ws.events.forEach((event) => { + results.push(this.messageManager.embed(message, new EventEmbed(this.bot, event, platform.toUpperCase()), true, true)); }); await Promise.all(results); return this.messageManager.statuses.SUCCESS; } - await this.messageManager.embed(message, new EventEmbed(this.bot, + await this.messageManager.embed(message, new EventEmbed(this.bot, undefined, platform.toUpperCase()), true, true); return this.messageManager.statuses.FAILURE; } From 9b7653e3c4c0222fe52a42169cd8cc4b341d51f0 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:11:32 -0500 Subject: [PATCH 12/16] fix indentation --- src/commands/Worldstate/Event.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/Worldstate/Event.js b/src/commands/Worldstate/Event.js index f0c11c98f..c94fd23f7 100644 --- a/src/commands/Worldstate/Event.js +++ b/src/commands/Worldstate/Event.js @@ -24,8 +24,8 @@ class Event extends Command { if (ws.events.length > 0) { const results = []; ws.events.forEach((event) => { - results.push(this.messageManager.embed(message, - new EventEmbed(this.bot, event, platform.toUpperCase()), true, true)); + results.push(this.messageManager.embed(message, + new EventEmbed(this.bot, event, platform.toUpperCase()), true, true)); }); await Promise.all(results); return this.messageManager.statuses.SUCCESS; From a47c01279b7fd192dffbb2fa701ae6c1f86925d8 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:12:34 -0500 Subject: [PATCH 13/16] fix indents --- src/embeds/EventEmbed.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/embeds/EventEmbed.js b/src/embeds/EventEmbed.js index 14588e735..775497148 100644 --- a/src/embeds/EventEmbed.js +++ b/src/embeds/EventEmbed.js @@ -21,8 +21,10 @@ class EventEmbed extends BaseEmbed { this.fields = []; if (event.victimNode) { - this.fields.push({ name: '_ _', value: `Defend ${event.victimNode}` + - ` by attacking the ${event.faction} at ${event.node}.` }); + this.fields.push({ + name: '_ _', + value: `Defend ${event.victimNode} by attacking the ${event.faction} at ${event.node}.`, + }); } this.fields.push({ name: 'Rewards', value: event.rewards.map(reward => reward.asString).join('; ') }); this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) }); From 6a86c7ce69aaa46c66dc8c014fe998ebfb8a48c4 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 19 Sep 2017 15:12:44 -0500 Subject: [PATCH 14/16] Update EventEmbed.js --- src/embeds/EventEmbed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/embeds/EventEmbed.js b/src/embeds/EventEmbed.js index 775497148..5bfd2fbd9 100644 --- a/src/embeds/EventEmbed.js +++ b/src/embeds/EventEmbed.js @@ -22,7 +22,7 @@ class EventEmbed extends BaseEmbed { if (event.victimNode) { this.fields.push({ - name: '_ _', + name: '_ _', value: `Defend ${event.victimNode} by attacking the ${event.faction} at ${event.node}.`, }); } From 9e34fbe82b37fe1f57bd0a37384ae72f75de7a5f Mon Sep 17 00:00:00 2001 From: Matej Voboril Date: Tue, 19 Sep 2017 21:12:55 -0500 Subject: [PATCH 15/16] add health to event --- src/embeds/EventEmbed.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/embeds/EventEmbed.js b/src/embeds/EventEmbed.js index 5bfd2fbd9..4be98ce8f 100644 --- a/src/embeds/EventEmbed.js +++ b/src/embeds/EventEmbed.js @@ -28,6 +28,10 @@ class EventEmbed extends BaseEmbed { } this.fields.push({ name: 'Rewards', value: event.rewards.map(reward => reward.asString).join('; ') }); this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) }); + + if (event.health) { + this.fields.push({ name: '_ _', value: `${event.health}% Remaining` }); + } } else { this.title = 'No Current Events'; } From 55ac182ff20e7710c99d9835a5a272daf0fa66e8 Mon Sep 17 00:00:00 2001 From: Matej Voboril Date: Tue, 19 Sep 2017 23:44:00 -0500 Subject: [PATCH 16/16] add platform to notifications and commands --- src/bot.js | 3 +- src/commands/Worldstate/Alerts.js | 5 +-- src/commands/Worldstate/Baro.js | 4 +-- src/commands/Worldstate/Construction.js | 2 +- src/commands/Worldstate/Darvo.js | 4 +-- src/commands/Worldstate/Enemies.js | 4 +-- src/commands/Worldstate/Event.js | 6 ++-- src/commands/Worldstate/FeaturedDeal.js | 4 +-- src/commands/Worldstate/Fissures.js | 4 +-- src/commands/Worldstate/Invasions.js | 4 +-- src/commands/Worldstate/News.js | 5 +-- src/commands/Worldstate/PopularSale.js | 5 +-- src/commands/Worldstate/PrimeAccess.js | 4 +-- src/commands/Worldstate/Simaris.js | 5 +-- src/commands/Worldstate/Sorties.js | 4 +-- src/commands/Worldstate/Syndicates.js | 4 +-- src/commands/Worldstate/Updates.js | 4 +-- src/embeds/AlertEmbed.js | 8 ++--- src/embeds/ConstructionEmbed.js | 2 +- src/embeds/DarvoEmbed.js | 5 +-- src/embeds/EarthCycleEmbed.js | 5 +-- src/embeds/EnemyEmbed.js | 7 ++-- src/embeds/EventEmbed.js | 4 +-- src/embeds/FissureEmbed.js | 7 ++-- src/embeds/InvasionEmbed.js | 7 ++-- src/embeds/NewsEmbed.js | 6 ++-- src/embeds/SalesEmbed.js | 5 +-- src/embeds/SimarisEmbed.js | 5 +-- src/embeds/SortieEmbed.js | 5 +-- src/embeds/SyndicateEmbed.js | 5 +-- src/embeds/VoidTraderEmbed.js | 5 +-- src/notifications/Notifier.js | 47 ++++++++++++------------- 32 files changed, 104 insertions(+), 90 deletions(-) diff --git a/src/bot.js b/src/bot.js index 54a1f2582..8f6625666 100644 --- a/src/bot.js +++ b/src/bot.js @@ -101,8 +101,7 @@ class Genesis { 'GUILD_MEMBER_REMOVE', 'GUILD_BAN_ADD', 'GUILD_BAN_REMOVE', 'CHANNEL_PINS_UPDATE', 'MESSAGE_UPDATE', 'MESSAGE_DELETE_BULK', 'MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE', 'MESSAGE_REACTION_REMOVE_ALL', 'USER_NOTE_UPDATE', - 'USER_SETTINGS_UPDATE', 'PRESENCE_UPDATE', 'TYPING_START', 'RELATIONSHIP_ADD', - 'RELATIONSHIP_REMOVE', + 'USER_SETTINGS_UPDATE', 'TYPING_START', 'RELATIONSHIP_ADD', 'RELATIONSHIP_REMOVE', ], }); diff --git a/src/commands/Worldstate/Alerts.js b/src/commands/Worldstate/Alerts.js index 852619bdd..bf37d1eea 100644 --- a/src/commands/Worldstate/Alerts.js +++ b/src/commands/Worldstate/Alerts.js @@ -19,9 +19,10 @@ class Alerts extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const alerts = ws.alerts.filter(a => !a.expired); - await this.messageManager.embed(message, new AlertEmbed(this.bot, alerts), true, false); + await this.messageManager.embed(message, + new AlertEmbed(this.bot, alerts, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Baro.js b/src/commands/Worldstate/Baro.js index 32acc95f8..d1629d750 100644 --- a/src/commands/Worldstate/Baro.js +++ b/src/commands/Worldstate/Baro.js @@ -19,9 +19,9 @@ class Baro extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); await this.messageManager.embed(message, - new VoidTraderEmbed(this.bot, ws.voidTrader), true, false); + new VoidTraderEmbed(this.bot, ws.voidTrader, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Construction.js b/src/commands/Worldstate/Construction.js index 3c0f4c3b0..7dbc07533 100644 --- a/src/commands/Worldstate/Construction.js +++ b/src/commands/Worldstate/Construction.js @@ -20,7 +20,7 @@ class Construction extends Command { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings .getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); await this.messageManager.embed(message, new EventEmbed(this.bot, ws.constructionProgress, platform.toUpperCase()), true, true); return this.messageManager.statuses.SUCCESS; diff --git a/src/commands/Worldstate/Darvo.js b/src/commands/Worldstate/Darvo.js index 2b5c583f4..f35138f6c 100644 --- a/src/commands/Worldstate/Darvo.js +++ b/src/commands/Worldstate/Darvo.js @@ -19,9 +19,9 @@ class Darvo extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const deal = ws.dailyDeals[0]; - await this.messageManager.embed(message, new DarvoEmbed(this.bot, deal), true, false); + await this.messageManager.embed(message, new DarvoEmbed(this.bot, deal, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Enemies.js b/src/commands/Worldstate/Enemies.js index 8ec83755f..0f42969c1 100644 --- a/src/commands/Worldstate/Enemies.js +++ b/src/commands/Worldstate/Enemies.js @@ -19,9 +19,9 @@ class Enemies extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); await this.messageManager.embed(message, - new EnemyEmbed(this.bot, ws.persistentEnemies), true, false); + new EnemyEmbed(this.bot, ws.persistentEnemies, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Event.js b/src/commands/Worldstate/Event.js index c94fd23f7..20daf8f70 100644 --- a/src/commands/Worldstate/Event.js +++ b/src/commands/Worldstate/Event.js @@ -18,9 +18,9 @@ class Event extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; - const platform = platformParam || await this.bot.settings - .getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const platform = (platformParam || await this.bot.settings + .getChannelSetting(message.channel, 'platform')).toLowerCase(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); if (ws.events.length > 0) { const results = []; ws.events.forEach((event) => { diff --git a/src/commands/Worldstate/FeaturedDeal.js b/src/commands/Worldstate/FeaturedDeal.js index f97d66e8a..c03f56550 100644 --- a/src/commands/Worldstate/FeaturedDeal.js +++ b/src/commands/Worldstate/FeaturedDeal.js @@ -19,10 +19,10 @@ class FeaturedDeal extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const sales = ws.flashSales.filter(popularItem => popularItem.isFeatured); await this.messageManager.embed(message, - new SalesEmbed(this.bot, sales), true, false); + new SalesEmbed(this.bot, sales, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Fissures.js b/src/commands/Worldstate/Fissures.js index 63d60e240..fe08cc202 100644 --- a/src/commands/Worldstate/Fissures.js +++ b/src/commands/Worldstate/Fissures.js @@ -19,10 +19,10 @@ class Fissures extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const fissures = ws.fissures.sort((a, b) => a.tierNum > b.tierNum); await this.messageManager.embed(message, - new FissureEmbed(this.bot, fissures), true, false); + new FissureEmbed(this.bot, fissures, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Invasions.js b/src/commands/Worldstate/Invasions.js index 755d8adae..1348ef67e 100644 --- a/src/commands/Worldstate/Invasions.js +++ b/src/commands/Worldstate/Invasions.js @@ -19,10 +19,10 @@ class Invasions extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const invasions = ws.invasions.filter(i => !i.completed); await this.messageManager.embed(message, - new InvasionEmbed(this.bot, invasions), true, false); + new InvasionEmbed(this.bot, invasions, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/News.js b/src/commands/Worldstate/News.js index 5812380aa..6d5458d2e 100644 --- a/src/commands/Worldstate/News.js +++ b/src/commands/Worldstate/News.js @@ -19,9 +19,10 @@ class News extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const news = ws.news.filter(n => !n.update && !n.primeAccess); - await this.messageManager.embed(message, new NewsEmbed(this.bot, news), true, false); + await this.messageManager.embed(message, + new NewsEmbed(this.bot, news, undefined, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/PopularSale.js b/src/commands/Worldstate/PopularSale.js index da4b4506d..24a660aaa 100644 --- a/src/commands/Worldstate/PopularSale.js +++ b/src/commands/Worldstate/PopularSale.js @@ -19,9 +19,10 @@ class PopularDeal extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const sales = ws.flashSales.filter(popularItem => popularItem.isPopular); - await this.messageManager.embed(message, new SalesEmbed(this.bot, sales), true, false); + await this.messageManager.embed(message, + new SalesEmbed(this.bot, sales, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/PrimeAccess.js b/src/commands/Worldstate/PrimeAccess.js index e00813f06..40ed4f397 100644 --- a/src/commands/Worldstate/PrimeAccess.js +++ b/src/commands/Worldstate/PrimeAccess.js @@ -19,9 +19,9 @@ class PrimeAccess extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const news = ws.news.filter(n => n.primeAccess); - await this.messageManager.embed(message, new PrimeAccessEmbed(this.bot, news, 'primeaccess'), true, false); + await this.messageManager.embed(message, new PrimeAccessEmbed(this.bot, news, 'primeaccess', platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Simaris.js b/src/commands/Worldstate/Simaris.js index 44026d611..6a6466c9f 100644 --- a/src/commands/Worldstate/Simaris.js +++ b/src/commands/Worldstate/Simaris.js @@ -19,9 +19,10 @@ class Simaris extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const simaris = ws.simaris; - await this.messageManager.embed(message, new SimarisEmbed(this.bot, simaris), true, false); + await this.messageManager.embed(message, + new SimarisEmbed(this.bot, simaris, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Sorties.js b/src/commands/Worldstate/Sorties.js index eaf7bdbb2..6f2c118c5 100644 --- a/src/commands/Worldstate/Sorties.js +++ b/src/commands/Worldstate/Sorties.js @@ -23,13 +23,13 @@ class Sorties extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const sortie = ws.sortie; if (sortie.expired) { await this.messageManager.sendMessage(message, 'There is currently no sortie', true, true); return this.messageManager.statuses.FAILURE; } - const embed = new SortieEmbed(this.bot, sortie); + const embed = new SortieEmbed(this.bot, sortie, platform); try { const articles = await warframe.getSearchList({ query: sortie.boss, limit: 1 }); const details = await warframe.getArticleDetails({ ids: articles.items.map(i => i.id) }); diff --git a/src/commands/Worldstate/Syndicates.js b/src/commands/Worldstate/Syndicates.js index a4fc41e83..06384adee 100644 --- a/src/commands/Worldstate/Syndicates.js +++ b/src/commands/Worldstate/Syndicates.js @@ -36,9 +36,9 @@ class Syndicates extends Command { platformParam = param1; } const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); await this.messageManager.embed(message, new SyndicateEmbed(this.bot, - ws.syndicateMissions, syndicate), true, false); + ws.syndicateMissions, syndicate, platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/commands/Worldstate/Updates.js b/src/commands/Worldstate/Updates.js index 3261d9345..1672f00d2 100644 --- a/src/commands/Worldstate/Updates.js +++ b/src/commands/Worldstate/Updates.js @@ -19,9 +19,9 @@ class Updates extends Command { async run(message) { const platformParam = message.strippedContent.match(this.regex)[1]; const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform'); - const ws = await this.bot.caches[platform].getDataJson(); + const ws = await this.bot.caches[platform.toLowerCase()].getDataJson(); const news = ws.news.filter(n => n.update); - await this.messageManager.embed(message, new UpdateEmbed(this.bot, news, 'update'), true, false); + await this.messageManager.embed(message, new UpdateEmbed(this.bot, news, 'update', platform), true, false); return this.messageManager.statuses.SUCCESS; } } diff --git a/src/embeds/AlertEmbed.js b/src/embeds/AlertEmbed.js index 0389fc50a..80bd2103d 100644 --- a/src/embeds/AlertEmbed.js +++ b/src/embeds/AlertEmbed.js @@ -9,8 +9,9 @@ class AlertEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Array.} alerts - The alerts to be included in the embed + * @param {string} platform - platform */ - constructor(bot, alerts) { + constructor(bot, alerts, platform) { super(); this.thumbnail = { @@ -23,11 +24,10 @@ class AlertEmbed extends BaseEmbed { value: `${a.mission.faction} ${a.mission.type} on ${a.mission.node}\n` + `level ${a.mission.minEnemyLevel} - ${a.mission.maxEnemyLevel}`, })); - this.title = 'Worldstate - Alerts'; - this.description = 'Currently in-progress alerts:'; + this.title = `[${platform.toUpperCase()}] Worldstate - Alerts`; } else { const a = alerts[0]; - this.title = a.mission.reward.itemString; + this.title = `[${platform.toUpperCase()}] ${a.mission.reward.itemString}`; this.url = 'https://ws.warframestat.us/'; this.color = a.mission.reward.color; this.thumbnail.url = a.mission.reward.thumbnail; diff --git a/src/embeds/ConstructionEmbed.js b/src/embeds/ConstructionEmbed.js index b59d7376f..0d9a70a52 100644 --- a/src/embeds/ConstructionEmbed.js +++ b/src/embeds/ConstructionEmbed.js @@ -16,7 +16,7 @@ class ConstructionEmbed extends BaseEmbed { this.color = 0xff6961; this.fields = [{ - name: `[${platform}] Construction Status:`, + name: `[${platform.toUpperCase()}] Construction Status:`, value: '```' + `Razorback: ${constructionProgress.razorbackProgress}` + `Fomorian: ${constructionProgress.fomorianProgress}` + diff --git a/src/embeds/DarvoEmbed.js b/src/embeds/DarvoEmbed.js index b599eec40..882be4831 100644 --- a/src/embeds/DarvoEmbed.js +++ b/src/embeds/DarvoEmbed.js @@ -9,12 +9,13 @@ class DarvoEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {DailyDeal} deal - The deal to be included in the embed + * @param {string} platform - platform */ - constructor(bot, deal) { + constructor(bot, deal, platform) { super(); this.color = 0x0000ff; - this.title = 'Darvo Deal'; + this.title = `[${platform.toUpperCase()}] Darvo Deal`; this.thumbnail = { url: 'http://i.imgur.com/UotylUm.png', }; diff --git a/src/embeds/EarthCycleEmbed.js b/src/embeds/EarthCycleEmbed.js index 4ef7f730c..79a1ff551 100644 --- a/src/embeds/EarthCycleEmbed.js +++ b/src/embeds/EarthCycleEmbed.js @@ -9,12 +9,13 @@ class EarthCycleEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Object} state - The current state of the cycle + * @param {string} platform - platform */ - constructor(bot, state) { + constructor(bot, state, platform) { super(); this.color = state.isDay ? 0x00ff00 : 0x000066; - this.title = 'Worldstate - Earth Cycle'; + this.title = `[${platform.toUpperCase()}] Worldstate - Earth Cycle`; this.thumbnail = { url: 'http://vignette1.wikia.nocookie.net/warframe/images/1/1e/Earth.png', }; diff --git a/src/embeds/EnemyEmbed.js b/src/embeds/EnemyEmbed.js index 3eeaad820..7c658bb99 100644 --- a/src/embeds/EnemyEmbed.js +++ b/src/embeds/EnemyEmbed.js @@ -9,14 +9,15 @@ class EnemyEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Array.} enemies - The persistentEnemies to be included in the embed + * @param {string} platform - platform */ - constructor(bot, enemies) { + constructor(bot, enemies, platform) { super(); this.thumbnail = { url: 'http://i.imgur.com/pMRt2Cp.png', }; - this.title = 'Acolytes'; + this.title = `[${platform.toUpperCase()}] Acolytes`; if (enemies.length > 1) { this.color = enemies.length > 2 ? 0x00ff00 : 0xff0000; this.fields = enemies.map(e => ({ @@ -27,7 +28,7 @@ class EnemyEmbed extends BaseEmbed { })); } else if (enemies.length === 1) { const e = enemies[0]; - this.title = e.agentType; + this.title = `[${platform.toUpperCase()}] ${e.agentType}`; this.description = `Enemy ${e.discovered ? 'Discovered' : 'Hiding'}!`; this.color = 0xaf5b4b; this.fields = [{ name: '_ _', value: `**${e.discovered ? '' : 'Last '}Discovered At:** ${e.lastDiscoveredAt}` }, diff --git a/src/embeds/EventEmbed.js b/src/embeds/EventEmbed.js index 4be98ce8f..fc56f81c2 100644 --- a/src/embeds/EventEmbed.js +++ b/src/embeds/EventEmbed.js @@ -17,7 +17,7 @@ class EventEmbed extends BaseEmbed { this.color = 0xfdec96; if (event) { - this.title = `[${platform}] ${event.description}`; + this.title = `[${platform.toUpperCase()}] ${event.description}`; this.fields = []; if (event.victimNode) { @@ -30,7 +30,7 @@ class EventEmbed extends BaseEmbed { this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) }); if (event.health) { - this.fields.push({ name: '_ _', value: `${event.health}% Remaining` }); + this.footer.text = `${event.health}% Remaining | ${this.footer.text}`; } } else { this.title = 'No Current Events'; diff --git a/src/embeds/FissureEmbed.js b/src/embeds/FissureEmbed.js index 68a41139b..9508a6ce6 100644 --- a/src/embeds/FissureEmbed.js +++ b/src/embeds/FissureEmbed.js @@ -9,12 +9,13 @@ class FissureEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Array.} fissures - The fissures to be included in the embed + * @param {string} platform - platform */ - constructor(bot, fissures) { + constructor(bot, fissures, platform) { super(); if (fissures.length < 2) { - this.title = 'Worldstate - Void Fissures'; + this.title = `[${platform.toUpperCase()}] Worldstate - Void Fissures`; } this.thumbnail = { url: 'http://i.imgur.com/EfIRu6v.png', @@ -33,7 +34,7 @@ class FissureEmbed extends BaseEmbed { }; } else { const f = fissures[0]; - this.title = `${f.missionType} ${f.tier}`; + this.title = `[${platform.toUpperCase()}] ${f.missionType} ${f.tier}`; this.description = `${f.node} against ${f.enemy}`; this.footer.text = `${f.eta} remaining | ${new Date().toLocaleString()}`; this.thumbnail.url = 'https://i.imgur.com/EfIRu6v.png'; diff --git a/src/embeds/InvasionEmbed.js b/src/embeds/InvasionEmbed.js index 801c697b0..637ce1ad1 100644 --- a/src/embeds/InvasionEmbed.js +++ b/src/embeds/InvasionEmbed.js @@ -9,8 +9,9 @@ class InvasionEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Array.} invasions - The invasions to be included in the embed + * @param {string} platform - platform */ - constructor(bot, invasions) { + constructor(bot, invasions, platform) { super(); this.color = 0x3498db; @@ -26,7 +27,7 @@ class InvasionEmbed extends BaseEmbed { value: `${i.desc} on ${i.node} - ETA ${i.eta}`, }; }); - this.title = 'Worldstate - Invasions'; + this.title = `[${platform.toUpperCase()}] Worldstate - Invasions`; this.description = 'Currently in-progress invasions:'; } else { const i = invasions[0]; @@ -35,7 +36,7 @@ class InvasionEmbed extends BaseEmbed { rewards = `${i.attackerReward.asString} vs ${rewards}`; } const completion = Math.round(i.completion * 100) / 100; - this.title = `${rewards} - ${completion > 0 ? completion : 0}%`; + this.title = `[${platform.toUpperCase()}] ${rewards} - ${completion > 0 ? completion : 0}%`; this.description = i.desc; this.fields = [ { name: 'Location', value: i.node, inline: true }, diff --git a/src/embeds/NewsEmbed.js b/src/embeds/NewsEmbed.js index 5ed6b9829..fe12b6381 100644 --- a/src/embeds/NewsEmbed.js +++ b/src/embeds/NewsEmbed.js @@ -11,8 +11,9 @@ class NewsEmbed extends BaseEmbed { * @param {Array.} news - The news to be included in the embed * @param {string} type - [Optional] type of embed between news, updates, * or prime access. Not provided for news. + * @param {string} platform - platform */ - constructor(bot, news, type) { + constructor(bot, news, type, platform) { super(); news.sort((a, b) => { @@ -34,7 +35,8 @@ class NewsEmbed extends BaseEmbed { value = value.length > 0 ? value : 'No News Currently'; } this.fields = [{ name: '_ _', value }]; - this.image = { url: news[0] ? news[0].imageLink : ''}; + this.image = { url: news[0] ? news[0].imageLink : '' }; + this.footer.text += ` | [${platform.toUpperCase()}]`; } } diff --git a/src/embeds/SalesEmbed.js b/src/embeds/SalesEmbed.js index b1bebe844..c59b5100d 100644 --- a/src/embeds/SalesEmbed.js +++ b/src/embeds/SalesEmbed.js @@ -9,12 +9,13 @@ class SalesEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Array.} sales - The sales to be displayed as featured or popular + * @param {string} platform - platform */ - constructor(bot, sales) { + constructor(bot, sales, platform) { super(); this.color = 0x0000ff; - this.title = sales[0].isPopular ? 'Popular Sales' : 'Featured Deal'; + this.title = sales[0].isPopular ? `[${platform.toUpperCase()}] Popular Sales ` : `[${platform.toUpperCase()}] Featured Deal`; this.thumbnail = { url: 'http://i.imgur.com/i9IXX7P.png', }; diff --git a/src/embeds/SimarisEmbed.js b/src/embeds/SimarisEmbed.js index 7dd9b4b3e..fdd4fdbef 100644 --- a/src/embeds/SimarisEmbed.js +++ b/src/embeds/SimarisEmbed.js @@ -9,14 +9,15 @@ class SimarisEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Simaris} simaris - The sanctuary state data to be included in the embed + * @param {string} platform - Platform */ - constructor(bot, simaris) { + constructor(bot, simaris, platform) { super(); this.thumbnail = { url: 'http://i.imgur.com/mRKOHyv.png', }; - this.title = 'Worldstate - Sanctuary'; + this.title = `[${platform.toUpperCase()}] Worldstate - Sanctuary`; this.color = simaris.isTargetActive > 2 ? 0x00ff00 : 0xff0000; this.fields = [{ name: simaris.asString, value: '_ _' }]; } diff --git a/src/embeds/SortieEmbed.js b/src/embeds/SortieEmbed.js index e38f67ac9..fe48f3caa 100644 --- a/src/embeds/SortieEmbed.js +++ b/src/embeds/SortieEmbed.js @@ -9,8 +9,9 @@ class SortieEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {Sortie} sortie - The sortie to be included in the embed + * @param {string} platform - platform */ - constructor(bot, sortie) { + constructor(bot, sortie, platform) { super(); this.color = 0xa84300; @@ -19,7 +20,7 @@ class SortieEmbed extends BaseEmbed { name: `${v.node} - ${v.missionType}`, value: v.modifier, })); - this.description = `Currently in-progress sortie: **${sortie.boss}**`; + this.description = `[${platform.toUpperCase()}] Currently in-progress sortie: **${sortie.boss}**`; this.footer.text = `${sortie.eta} remaining | ${new Date().toLocaleString()}`; } diff --git a/src/embeds/SyndicateEmbed.js b/src/embeds/SyndicateEmbed.js index 9870bd416..e3590c290 100644 --- a/src/embeds/SyndicateEmbed.js +++ b/src/embeds/SyndicateEmbed.js @@ -12,8 +12,9 @@ class SyndicateEmbed extends BaseEmbed { * @param {Genesis} bot - An instance of Genesis * @param {Array.} missions - The missions to be included in the embed * @param {string} syndicate - The syndicate to display the missions for + * @param {string} platform - Platform */ - constructor(bot, missions, syndicate) { + constructor(bot, missions, syndicate, platform) { super(); const foundSyndicate = values.find(v => syndicate && @@ -34,7 +35,7 @@ class SyndicateEmbed extends BaseEmbed { value: `Valid values: ${values.join(', ')}`, }]; } - this.description = `Current Missions for ${syndicate || 'None'}`; + this.description = `[${platform.toUpperCase()}] Current Missions`; this.thumbnail = { url: 'https://i.imgur.com/I8CjF9d.png', }; diff --git a/src/embeds/VoidTraderEmbed.js b/src/embeds/VoidTraderEmbed.js index bfe589d4a..81695fc2b 100644 --- a/src/embeds/VoidTraderEmbed.js +++ b/src/embeds/VoidTraderEmbed.js @@ -9,8 +9,9 @@ class VoidTraderEmbed extends BaseEmbed { /** * @param {Genesis} bot - An instance of Genesis * @param {VoidTrader} voidTrader - The current state of the Void Trader + * @param {string} platform - platform */ - constructor(bot, voidTrader) { + constructor(bot, voidTrader, platform) { super(); this.color = voidTrader.active ? 0x0EC9FF : 0xff6961; @@ -28,7 +29,7 @@ class VoidTraderEmbed extends BaseEmbed { name: `Time until ${voidTrader.active ? 'departure from' : 'arrival at'} ${voidTrader.location}`, value: `${voidTrader.active ? voidTrader.endString : voidTrader.startString}` || 'Data Pending', }); - this.title = 'Worldstate - Void Trader'; + this.title = `[${platform.toUpperCase()}] Worldstate - Void Trader`; this.thumbnail = { url: 'http://i.imgur.com/z0wU29P.png', }; diff --git a/src/notifications/Notifier.js b/src/notifications/Notifier.js index ae6468769..5e28100fb 100644 --- a/src/notifications/Notifier.js +++ b/src/notifications/Notifier.js @@ -181,13 +181,13 @@ class Notifier { * @param {string} platform platform corresponding to notified ids */ async updateNotified(ids, platform) { - await this.settings.setNotifiedIds(platform, this.bot.shardId, ids); + await this.settings.setNotifiedIds(platform, this.bot.shardId, ids, platform); } async sendAcolytes(newAcolytes, platform) { const results = []; for (const a of newAcolytes) { - const embed = new EnemyEmbed(this.bot, [a]); + const embed = new EnemyEmbed(this.bot, [a], platform); results.push(this.broadcast(embed, platform, 'enemies', null, 3600000)); } Promise.all(results); @@ -202,7 +202,7 @@ class Notifier { } async sendAlert(a, platform) { - const embed = new AlertEmbed(this.bot, [a]); + const embed = new AlertEmbed(this.bot, [a], platform); try { const articles = await warframe.getSearchList({ query: a.mission.reward.itemString, @@ -222,20 +222,20 @@ class Notifier { } async sendBaro(newBaro, platform) { - const embed = new VoidTraderEmbed(this.bot, newBaro); + const embed = new VoidTraderEmbed(this.bot, newBaro, platform); await this.broadcast(embed, platform, 'baro', null); } async sendConclaveDailies(newDailies, platform) { if (newDailies.filter(challenge => challenge.category === 'day').length > 0) { - const embed = new ConclaveChallengeEmbed(this.bot, newDailies, 'day'); + const embed = new ConclaveChallengeEmbed(this.bot, newDailies, 'day', platform); await this.broadcast(embed, platform, 'conclave.dailies', null, fromNow(newDailies[0].expiry)); } } async sendConclaveWeeklies(newWeeklies, platform) { if (newWeeklies.filter(challenge => challenge.category === 'week').length > 0) { - const embed = new ConclaveChallengeEmbed(this.bot, newWeeklies, 'week'); + const embed = new ConclaveChallengeEmbed(this.bot, newWeeklies, 'week', platform); await this.broadcast(embed, platform, 'conclave.weeklies', null, fromNow(newWeeklies[0].expiry)); } } @@ -243,7 +243,7 @@ class Notifier { async sendDarvo(newDarvoDeals, platform) { const results = []; for (const d of newDarvoDeals) { - const embed = new DarvoEmbed(this.bot, d); + const embed = new DarvoEmbed(this.bot, d, platform); results.push(this.broadcast(embed, platform, 'darvo', null, fromNow(d.expiry))); } Promise.all(results); @@ -252,7 +252,7 @@ class Notifier { async sendEvent(newEvents, platform) { const results = []; for (const e of newEvents) { - const embed = new EventEmbed(this.bot, [e]); + const embed = new EventEmbed(this.bot, [e], platform); results.push(this.broadcast(embed, platform, 'events', null, fromNow(e.expiry))); } Promise.all(results); @@ -261,7 +261,7 @@ class Notifier { async sendFeaturedDeals(newFeaturedDeals, platform) { const results = []; for (const d of newFeaturedDeals) { - const embed = new SalesEmbed(this.bot, [d]); + const embed = new SalesEmbed(this.bot, [d], platform); results.push(this.broadcast(embed, platform, 'deals.featured', null, fromNow(d.expiry))); } Promise.all(results); @@ -270,7 +270,7 @@ class Notifier { async sendFissures(newFissures, platform) { const results = []; for (const f of newFissures) { - const embed = new FissureEmbed(this.bot, [f]); + const embed = new FissureEmbed(this.bot, [f], platform); results.push(this.broadcast(embed, platform, `fissures.t${f.tierNum}`, null, fromNow(f.expiry))); } Promise.all(results); @@ -285,7 +285,7 @@ class Notifier { } async sendInvasion(invasion, platform) { - const embed = new InvasionEmbed(this.bot, [invasion]); + const embed = new InvasionEmbed(this.bot, [invasion], platform); try { const articles = await warframe.getSearchList({ query: invasion.attackerReward.itemString, @@ -309,7 +309,7 @@ class Notifier { async sendNews(newNews, platform) { const results = []; for (const i of newNews) { - const embed = new NewsEmbed(this.bot, [i]); + const embed = new NewsEmbed(this.bot, [i], undefined, platform); results.push(this.broadcast(embed, platform, 'news')); } Promise.all(results); @@ -318,17 +318,16 @@ class Notifier { async sendStreams(newStreams, platform) { const results = []; for (const i of newStreams) { - const embed = new NewsEmbed(this.bot, [i]); + const embed = new NewsEmbed(this.bot, [i], platform); results.push(this.broadcast(embed, platform, 'streams')); } Promise.all(results); } - async sendPopularDeals(newPopularDeals, platform) { const results = []; for (const d of newPopularDeals) { - const embed = new SalesEmbed(this.bot, [d]); + const embed = new SalesEmbed(this.bot, [d], platform); results.push(this.broadcast(embed, platform, 'deals.popular', null, 86400000)); } Promise.all(results); @@ -337,7 +336,7 @@ class Notifier { async sendPrimeAccess(newNews, platform) { const results = []; for (const i of newNews) { - const embed = new NewsEmbed(this.bot, [i]); + const embed = new NewsEmbed(this.bot, [i], platform); results.push(this.broadcast(embed, platform, 'primeaccess', null)); } Promise.all(results); @@ -346,14 +345,14 @@ class Notifier { async sendUpdates(newNews, platform) { const results = []; for (const i of newNews) { - const embed = new NewsEmbed(this.bot, [i]); + const embed = new NewsEmbed(this.bot, [i], platform); results.push(this.broadcast(embed, platform, 'updates', null)); } Promise.all(results); } async sendSortie(newSortie, platform) { - const embed = new SortieEmbed(this.bot, newSortie); + const embed = new SortieEmbed(this.bot, newSortie, platform); try { const articles = await warframe.getSearchList({ query: newSortie.boss, @@ -375,32 +374,32 @@ class Notifier { } async sendSyndicateArbiters(newSyndicates, platform) { - const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Arbiters of Hexis'); + const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Arbiters of Hexis', platform); await this.broadcast(embed, platform, 'syndicate.arbiters', null, 86400000); } async sendSyndicateLoka(newSyndicates, platform) { - const embed = new SyndicateEmbed(this.bot, newSyndicates, 'New Loka'); + const embed = new SyndicateEmbed(this.bot, newSyndicates, 'New Loka', platform); await this.broadcast(embed, platform, 'syndicate.loka', null, 86400000); } async sendSyndicateMeridian(newSyndicates, platform) { - const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Steel Meridian'); + const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Steel Meridian', platform); await this.broadcast(embed, platform, 'syndicate.meridian', null, 86400000); } async sendSyndicatePerrin(newSyndicates, platform) { - const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Perrin Sequence'); + const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Perrin Sequence', platform); await this.broadcast(embed, platform, 'syndicate.perin', null, 86400000); } async sendSyndicateSuda(newSyndicates, platform) { - const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Cephalon Suda'); + const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Cephalon Suda', platform); await this.broadcast(embed, platform, 'syndicate.suda', null, 86400000); } async sendSyndicateVeil(newSyndicates, platform) { - const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Red Veil'); + const embed = new SyndicateEmbed(this.bot, newSyndicates, 'Red Veil', platform); await this.broadcast(embed, platform, 'syndicate.veil', null, 86400000); } }