Skip to content

Commit

Permalink
Fix the links on the embeds being wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
bartdebever committed Jul 9, 2024
1 parent c2e18aa commit 95f5738
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/embeds/knockback-embed-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CharacterEmoji } from '../utils/character-emoji';
import { Loader } from '../data/loader';
import { Hitbox } from '../models/hitbox';
import { versionNumber } from '../meta-data';
import { getMoveLink } from '../utils/fightcore-link';

export abstract class KnockbackEmbedCreator extends BaseEmbedCreator {
constructor(private knockbackTarget: number, private longTerm: string, private shortTerm: string) {
Expand All @@ -22,12 +23,10 @@ export abstract class KnockbackEmbedCreator extends BaseEmbedCreator {
} else {
embedCreator.addFields({
name: 'No GIF available',
value: 'There is no GIF available for this move. Visit https://www.fightcore.gg to help us out.',
value: 'There is no GIF available for this move.',
});
}
embedCreator.setURL(
`https://fightcore.gg/characters/${character.fightCoreId}/${character.normalizedName}/moves/${move.id}/${move.normalizedName}/?utm_source=fightcore_bot`
);
embedCreator.setURL(getMoveLink(character, move));

if (target) {
return this.createForTarget(character, move, target, embedCreator);
Expand Down
7 changes: 3 additions & 4 deletions src/embeds/move-embed-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { BodyFormatter } from './formatting/body-formatter';
import { InfoLine } from './formatting/info-line';
import { LineProperty } from './formatting/line-property';
import { versionNumber } from '../meta-data';
import { getMoveLink } from '../utils/fightcore-link';

export class MoveEmbedCreator extends BaseEmbedCreator {
private readonly move: Move;
Expand Down Expand Up @@ -147,9 +148,7 @@ export class MoveEmbedCreator extends BaseEmbedCreator {

const moveEmbed = this.baseEmbed()
.setTitle(`${this.character.name} - ${this.move.name}`)
.setURL(
`https://fightcore.gg/characters/${this.character.normalizedName}/moves/${this.move.normalizedName}?referer=fightcore_bot`
)
.setURL(getMoveLink(this.character, this.move))
.setColor(this.embedColor)
.addFields(moveEmbedFields);

Expand All @@ -158,7 +157,7 @@ export class MoveEmbedCreator extends BaseEmbedCreator {
} else {
moveEmbed.addFields({
name: 'No GIF available',
value: 'There is no GIF available for this move. Visit https://www.fightcore.gg to help us out.',
value: 'There is no GIF available for this move.',
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/meta-data.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const versionNumber = '2.5.0';
export const versionNumber = '2.5.1';
6 changes: 6 additions & 0 deletions src/utils/fightcore-link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Character } from '../models/character';
import { Move } from '../models/move';

export function getMoveLink(character: Character, move: Move): string {
return `https://fightcore.gg/characters/${character.fightCoreId}/${character.normalizedName}/moves/${move.id}/${move.normalizedName}?referer=fightcore_bot`;
}

0 comments on commit 95f5738

Please sign in to comment.