Skip to content

Commit

Permalink
fix: don't include solaris bounty data in notification, check in case…
Browse files Browse the repository at this point in the history
… bounty data is empty
  • Loading branch information
TobiTenno committed Nov 19, 2018
1 parent bdfbf22 commit 215d088
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
12 changes: 5 additions & 7 deletions src/commands/Worldstate/Solaris.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ class Solaris extends Command {
const ws = await this.bot.worldStates[platform.toLowerCase()].getData();
const solaris = ws.syndicateMissions.filter(m => m.syndicate === 'Solaris United');

const vallis = ws.vallisCycle;
if (solaris && solaris.length) {
const vallis = ws.vallisCycle;
[vallis.bounty] = solaris;

// make the embed
this.messageManager.embed(message, new SolarisEmbed(this.bot, vallis), true, true);
return this.messageManager.statuses.SUCCESS;
}
this.messageManager.reply(message, 'No data at present', true, true);
return this.messageManager.statuses.FAILURE;

// make the embed
this.messageManager.embed(message, new SolarisEmbed(this.bot, vallis), true, true);
return this.messageManager.statuses.SUCCESS;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/embeds/SolarisEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SolarisEmbed extends BaseEmbed {
url: solaris,
};
const warmstring = `Time remaining until ${state.isWarm ? 'cold' : 'warm'}: ${timeDeltaToString(fromNow(new Date(state.expiry)))}`;
this.description = `${makeJobs(state.bounty, 1)}\n\n${warmstring}`;
this.description = `${state.bounty ? makeJobs(state.bounty, 1) : ''}\n\n${warmstring}`;

this.footer.text = `${state.isWarm ? 'Cold' : 'Warm'} starts `;
this.timestamp = new Date(state.expiry);
Expand Down
6 changes: 1 addition & 5 deletions src/notifications/Notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,7 @@ class Notifier {
}
await this.sendCetusCycle(newData.cetusCycle, platform, cetusCycleChange);
await this.sendEarthCycle(newData.earthCycle, platform, earthCycleChange);
const solaris = newData.syndicateMissions.filter(mission => mission.syndicate === 'Solaris United')[0];
if (solaris) {
// eslint-disable-next-line no-param-reassign
newData.vallisCycle.bounty = solaris;
}

await this.sendVallisCycle(newData.vallisCycle, platform, vallisCycleChange);
this.sendUpdates(updatesToNotify, platform);
await this.sendAlerts(alertsToNotify, platform);
Expand Down

0 comments on commit 215d088

Please sign in to comment.