Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(signups): embed now displays coordinator selected prog point #273

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/commands/signup/signup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
settings: SettingsDocument,
) {
const [sourceEmbed] = message.embeds;
const embed = EmbedBuilder.from(sourceEmbed);
let embed = EmbedBuilder.from(sourceEmbed);

Check warning on line 196 in src/commands/signup/signup.service.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/signup/signup.service.ts#L196

Added line #L196 was not covered by tests
const { guildId } = message;

const [displayName, progPoint] = await Promise.all([
Expand All @@ -204,6 +204,19 @@
this.requestProgPointConfirmation(signup, sourceEmbed, user),
]);

// TODO: Don't use magic strings for field names
const progPointFieldIndex =
embed.data.fields?.findIndex((field) => field.name === 'Prog Point') ??
-1;

if (progPointFieldIndex !== -1 && progPoint) {
embed = embed.spliceFields(progPointFieldIndex, 1, {
name: 'Prog Point',
value: progPoint,
inline: true,
});
}

Check warning on line 219 in src/commands/signup/signup.service.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/signup/signup.service.ts#L207-L219

Added lines #L207 - L219 were not covered by tests
const partyType =
(progPoint &&
EncounterProgPoints[signup.encounter][progPoint]?.partyType) ||
Expand Down
Loading