Skip to content

Commit

Permalink
fix: when no facet
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed Jun 4, 2024
1 parent 72c2c9a commit 3519df2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/dota/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"won": "Won last game"
},
"facet": "{{- heroName}} facet: {{- facetTitle}} · {{- facetDescription}}",
"facetNotFound": "{{- heroName}} facet cannot be found · Live matches can only get streamer's facet",
"lifetime": "Lifetime games",
"matchFound": "Match data found {{commandList}} commands activated.",
"matchId": "Match ID: {{matchId}}",
Expand Down
11 changes: 11 additions & 0 deletions packages/dota/src/twitch/commands/facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ commandHandler.registerCommand('facet', {
const facet =
DOTA_HERO_ABILITIES?.[hero.name as keyof typeof DOTA_HERO_ABILITIES]?.facets[hero.facet - 1]

if (!facet) {
chatClient.say(
channel,
t('facetNotFound', {
lng: message.channel.client.locale,
heroName: getHeroNameOrColor(hero?.id ?? 0, playerIdx),
}),
)
return
}

chatClient.say(
channel,
t('facet', {
Expand Down

0 comments on commit 3519df2

Please sign in to comment.