File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
src/main/java/pw/chew/mlb Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public static void main(String[] args) throws IOException {
5555 CommandClientBuilder client = new CommandClientBuilder ();
5656
5757 // Set the client settings
58- client .setActivity (Activity .watching ("the regular season !" ));
58+ client .setActivity (Activity .watching ("the all star game !" )); // ASG
5959 client .setOwnerId (prop .getProperty ("userId" , "476488167042580481" ));
6060 client .setPrefix ("woody!" );
6161
Original file line number Diff line number Diff line change @@ -16,10 +16,16 @@ public JSONObject record() {
1616 }
1717
1818 public int wins () {
19+ // ASG Shenanigans
20+ if (name ().equals ("NL All-Stars" )) return 44 ;
21+ if (name ().equals ("AL All-Stars" )) return 48 ;
1922 return record ().getInt ("wins" );
2023 }
2124
2225 public int losses () {
26+ // ASG Shenanigans
27+ if (name ().equals ("NL All-Stars" )) return 48 ;
28+ if (name ().equals ("AL All-Stars" )) return 44 ;
2329 return record ().getInt ("losses" );
2430 }
2531
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ public List<Command.Choice> asChoices() {
136136 public record Teams (JSONArray raw ) {
137137 public List <Command .Choice > asChoices () {
138138 List <Command .Choice > choices = new ArrayList <>();
139+ // ASG Shenanigans
140+ choices .add (new Command .Choice ("All Star Game" , 160 ));
139141 for (int i = 0 ; i < raw .length (); i ++) {
140142 JSONObject team = raw .getJSONObject (i );
141143 choices .add (new Command .Choice (team .getString ("name" ), team .getInt ("id" )));
@@ -169,8 +171,11 @@ public List<Command.Choice> potentialChoices(String query) {
169171 }
170172 }
171173
172- // Send a message if we don't know what team
173- return potential ;
174+ // ASG Shenanigans
175+ potential .add (new Command .Choice ("All Star Game" , 160 ));
176+
177+ // Return the potential list, distinct, and no more than 25 choices
178+ return potential .stream ().distinct ().toList ().subList (0 , Math .min (potential .size (), 25 ));
174179 }
175180 }
176181
You can’t perform that action at this time.
0 commit comments