-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fomorian/Razorback construction and Events (#125)
* adding embeds * Add commands for previously added embeds * fix bad parentheses * fix parens * fix indents * fix indents * fix comma and syntax (construction didn't exist) * fix some indents and line length * fix line length * fix line length * stickler fixes * fix indentation * fix indents * Update EventEmbed.js * add health to event * add platform to notifications and commands
- Loading branch information
Showing
32 changed files
with
236 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'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.toLowerCase()].getDataJson(); | ||
await this.messageManager.embed(message, new EventEmbed(this.bot, | ||
ws.constructionProgress, platform.toUpperCase()), true, true); | ||
return this.messageManager.statuses.SUCCESS; | ||
} | ||
} | ||
|
||
module.exports = Construction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'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')).toLowerCase(); | ||
const ws = await this.bot.caches[platform.toLowerCase()].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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.toUpperCase()}] Construction Status:`, | ||
value: '```' + | ||
`Razorback: ${constructionProgress.razorbackProgress}` + | ||
`Fomorian: ${constructionProgress.fomorianProgress}` + | ||
`Unknown: ${constructionProgress.unknwonProgress}` + | ||
'```', | ||
}]; | ||
} | ||
} | ||
|
||
module.exports = ConstructionEmbed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.