@@ -121,10 +121,12 @@ public void onStringSelectSelection(StringSelectInteractionEvent event, List<Str
121
121
}
122
122
123
123
long remainingMinutes = applicationApplyHandler .getMemberCooldownMinutes (member );
124
+ String correctMinutesWord = selectWordFromCount (remainingMinutes , "minute" , "minutes" );
125
+
124
126
if (remainingMinutes > 0 ) {
125
127
event
126
- .reply ("Please wait %d minutes before sending a new application form."
127
- .formatted (remainingMinutes ))
128
+ .reply ("Please wait %d %s before sending a new application form."
129
+ .formatted (remainingMinutes , correctMinutesWord ))
128
130
.setEphemeral (true )
129
131
.queue ();
130
132
return ;
@@ -157,6 +159,23 @@ public void onStringSelectSelection(StringSelectInteractionEvent event, List<Str
157
159
event .replyModal (modal ).queue ();
158
160
}
159
161
162
+ /**
163
+ * Selects and returns the appropriate singular or plural form of a word based on the given
164
+ * count.
165
+ *
166
+ * @param singularForm the word in its singular form
167
+ * @param pluralForm the word in its plural form
168
+ * @param count the number used to determine whether to return the singular or plural form
169
+ * @return the singular form if count equals 1, otherwise the plural form
170
+ */
171
+ private String selectWordFromCount (final Number count , final String singularForm ,
172
+ final String pluralForm ) {
173
+ if (count .intValue () == 1 ) {
174
+ return singularForm ;
175
+ }
176
+ return pluralForm ;
177
+ }
178
+
160
179
/**
161
180
* Checks a given list of passed arguments (from a user) and calculates how many roles have
162
181
* missing data.
0 commit comments