Skip to content

Commit 0850736

Browse files
committed
fix bug when there is no live game
1 parent a6fb092 commit 0850736

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/command-util.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,9 @@ module.exports = {
774774

775775
getBatterEmbed: (batter, batterInfo, isLiveGame, description, savantMode = false) => {
776776
const feed = liveFeed.init(globalCache.values.game.currentLiveFeed);
777-
const expandedBatter = feed.players()['ID' + batter.id];
777+
let expandedBatter;
778778
if (isLiveGame) {
779+
expandedBatter = feed.players()['ID' + batter.id];
779780
const abbreviations = {
780781
home: feed.homeAbbreviation(),
781782
away: feed.awayAbbreviation()
@@ -803,12 +804,12 @@ module.exports = {
803804
} else {
804805
const embed = new EmbedBuilder()
805806
.setTitle(`${batter.fullName} (${globals.TEAMS.find(team => team.id === batter.currentTeam.id).abbreviation})`)
806-
.setDescription(`${expandedBatter.primaryPosition.abbreviation} | Bats ${batterInfo.stats.batSide.description}`)
807+
.setDescription(`${batter.primaryPosition.abbreviation} | Bats ${batterInfo.stats.batSide.description}`)
807808
.setImage('attachment://savant.png')
808809
.setColor(globals.TEAMS.find(team => team.id === batter.currentTeam.id).primaryColor);
809810

810811
if (description) {
811-
embed.setDescription(`${expandedBatter.primaryPosition.abbreviation} | Bats ${batterInfo.stats.batSide.description}` + description);
812+
embed.setDescription(`${batter.primaryPosition.abbreviation} | Bats ${batterInfo.stats.batSide.description}` + description);
812813
}
813814

814815
if (!savantMode) {

0 commit comments

Comments
 (0)