Skip to content

Commit

Permalink
feat: add syndicates command
Browse files Browse the repository at this point in the history
closes #573

found #576
  • Loading branch information
TobiTenno committed Oct 10, 2022
1 parent b8f6ac1 commit d8f47c7
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/interactions/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ export default class Settings extends Interaction {
.map((id) => guild.roles.cache.get(id.trim()));

static enabled = true;
static elevated = true;
static command = {
...cmds.settings,
defaultMemberPermissions: Permissions.FLAGS.MANAGE_GUILD,
Expand Down
1 change: 1 addition & 0 deletions src/interactions/tracking/Tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const chunkerate = (track) => {
const subgrouped = ['arbitration', 'fissures', 'twitter'];

export default class Settings extends Interaction {
static elevated = true;
static command = {
...cmds.tracking,
defaultMemberPermissions: Permissions.FLAGS.MANAGE_GUILD,
Expand Down
32 changes: 31 additions & 1 deletion src/interactions/warframe/Worldstate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Solaris from '../../embeds/SolarisEmbed.js';
import Nightwave from '../../embeds/NightwaveEmbed.js';
import Outposts from '../../embeds/SentientOutpostEmbed.js';
import SteelPath from '../../embeds/SteelPathEmbed.js';
import { cmds, platformMap as platformChoices } from '../../resources/index.js';
import { cmds, platformMap as platformChoices, syndicates as syndicateOptions } from '../../resources/index.js';

const { ApplicationCommandOptionTypes: Types } = Constants;

Expand All @@ -39,6 +39,7 @@ const aliases = {
sales: 'flashSales',
steelpath: 'steelPath',
archons: 'archonHunt',
syndicate: 'syndicateMissions',
};
const embeds = {
arbitration: Arbitration,
Expand Down Expand Up @@ -89,6 +90,10 @@ const places = [
value: 'cambion',
},
];
const syndicates = syndicateOptions.map((s) => ({
name: s.display,
value: s.display,
}));
const compactable = [
...platformable,
{
Expand Down Expand Up @@ -227,6 +232,19 @@ export default class WorldState extends Interaction {
...cmds.sortie,
options: platformable,
},
{
...cmds.syndicate,
options: [
{
type: Types.STRING,
name: 'syndicate',
description: 'Which syndicate?',
required: true,
choices: syndicates,
},
...platformable,
],
},
];

static async commandHandler(interaction, ctx) {
Expand All @@ -240,6 +258,7 @@ export default class WorldState extends Interaction {

let category = options?.get?.('category')?.value || 'all';
const place = options?.get?.('place')?.value;
const syndicate = options?.get?.('syndicate')?.value;

const key = `${subcommand}${place ? `::${place}` : ''}`;
const field = aliases[key] || subcommand || undefined;
Expand Down Expand Up @@ -347,6 +366,17 @@ export default class WorldState extends Interaction {
}
embed = new embeds[field](data, { isCommand: true, i18n: ctx.i18n });
return interaction.editReply({ embeds: [embed] });
case 'syndicateMissions':
const missions = data?.filter((m) => {
return syndicate !== 'all' || m.syndicateKey === syndicate;
});
if (!missions) break;
pages = missions
.map((mission) => {
return new Syndicate([mission], { syndicate, i18n: ctx.i18n, platform, locale: ctx.language });
})
.filter((p) => p.title);
return interaction.editReply({ embeds: pages });
default:
break;
}
Expand Down
20 changes: 6 additions & 14 deletions src/resources/cachedEvents.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
[
"cetus.day",
"cetus.night",
"cetus.day.5",
"cetus.day.10",
"cetus.day.15",
"cetus.day.20",
"cetus.night.5",
"cetus.night.10",
"cetus.night.15",
"cetus.night.20",
"cetus.day.1",
"deimos.fass.1",
"deimos.vome.1",
"solaris.warm.1",
"solaris.cold.1",
"deimos.fass",
"deimos.vome",
"solaris.warm",
Expand Down Expand Up @@ -85,5 +72,10 @@
"fissures.t5.assassination",
"steelpath",
"steelpath.umbra",
"archonhunt"
"archonhunt",
"syndicate.ostrons",
"syndicate.quills",
"vox",
"necralisk",
"solaris"
]
4 changes: 4 additions & 0 deletions src/resources/locales/commands/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ export default {
name: 'value',
description: 'Should be a category',
},
'syndicate': {
name: 'syndicate',
description: 'Get current syndicate information for a given syndicate'
},
tracking: {
name: 'tracking',
description: 'Configure tracking options',
Expand Down

0 comments on commit d8f47c7

Please sign in to comment.