Skip to content

Commit d1e9f99

Browse files
committed
all star game 2024 changes
1 parent 98cab34 commit d1e9f99

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/main/java/pw/chew/mlb/MLBBot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static void main(String[] args) throws IOException {
5252
CommandClientBuilder client = new CommandClientBuilder();
5353

5454
// Set the client settings
55-
client.setActivity(Activity.watching("the 2024 season!"));
55+
client.setActivity(Activity.watching("the all star game!")); // ASG Shenanigans
5656
client.setOwnerId(prop.getProperty("userId", "476488167042580481"));
5757
client.setPrefix("woody!");
5858

src/main/java/pw/chew/mlb/objects/MLBTeam.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ public JSONObject record() {
1616
}
1717

1818
public int wins() {
19+
// ASG Shenanigans
20+
// ASG Shenanigans
21+
if (name().equals("NL All-Stars")) return 45;
22+
if (name().equals("AL All-Stars")) return 46;
1923
return record().getInt("wins");
2024
}
2125

2226
public int losses() {
27+
// ASG Shenanigans
28+
if (name().equals("NL All-Stars")) return 46;
29+
if (name().equals("AL All-Stars")) return 45;
2330
return record().getInt("losses");
2431
}
2532

src/main/java/pw/chew/mlb/util/MLBAPIUtil.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ public List<Command.Choice> asChoices() {
135135
public record Teams(JSONArray raw) {
136136
public List<Command.Choice> asChoices() {
137137
List<Command.Choice> choices = new ArrayList<>();
138+
// ASG Shenanigans
139+
choices.add(new Command.Choice("All Star Game", 160));
138140
for (int i = 0; i < raw.length(); i++) {
139141
JSONObject team = raw.getJSONObject(i);
140142
choices.add(new Command.Choice(team.getString("name"), team.getInt("id")));
@@ -168,8 +170,11 @@ public List<Command.Choice> potentialChoices(String query) {
168170
}
169171
}
170172

171-
// Send a message if we don't know what team
172-
return potential;
173+
// ASG Shenanigans
174+
potential.add(new Command.Choice("All Star Game", 160));
175+
176+
// Return the potential list, distinct, and no more than 25 choices
177+
return potential.stream().distinct().toList().subList(0, Math.min(potential.size(), 25));
173178
}
174179
}
175180

0 commit comments

Comments
 (0)