@@ -37,13 +37,14 @@ public class ApplicationApplyHandler {
3737 /**
3838 * Constructs a new {@code ApplicationApplyHandler} instance.
3939 *
40- * @param roleApplicationSystemConfig the configuration that contains the details for the application form
41- * including the cooldown duration and channel pattern.
40+ * @param roleApplicationSystemConfig the configuration that contains the details for the
41+ * application form including the cooldown duration and channel pattern.
4242 */
4343 public ApplicationApplyHandler (RoleApplicationSystemConfig roleApplicationSystemConfig ) {
4444 this .roleApplicationSystemConfig = roleApplicationSystemConfig ;
4545 this .applicationChannelPattern =
46- Pattern .compile (roleApplicationSystemConfig .submissionsChannelPattern ()).asMatchPredicate ();
46+ Pattern .compile (roleApplicationSystemConfig .submissionsChannelPattern ())
47+ .asMatchPredicate ();
4748
4849 final Duration applicationSubmitCooldownDuration =
4950 Duration .ofMinutes (roleApplicationSystemConfig .applicationSubmitCooldownMinutes ());
@@ -85,8 +86,8 @@ protected void sendApplicationResult(final ModalInteractionEvent event, List<Str
8586 MessageEmbed .Field roleField = new MessageEmbed .Field ("Role" , roleString , false );
8687 embed .addField (roleField );
8788
88- MessageEmbed .Field answerField =
89- new MessageEmbed . Field ( roleApplicationSystemConfig .defaultQuestion (), answer , false );
89+ MessageEmbed .Field answerField = new MessageEmbed . Field (
90+ roleApplicationSystemConfig .defaultQuestion (), answer , false );
9091 embed .addField (answerField );
9192
9293 applicationChannel .get ().sendMessageEmbeds (embed .build ()).queue ();
@@ -129,4 +130,14 @@ protected void submitApplicationFromModalInteraction(ModalInteractionEvent event
129130
130131 applicationSubmitCooldown .put (event .getMember (), OffsetDateTime .now ());
131132 }
133+
134+ protected long getMemberCooldownMinutes (Member member ) {
135+ OffsetDateTime timeSentCache = getApplicationSubmitCooldown ().getIfPresent (member );
136+ if (timeSentCache != null ) {
137+ Duration duration = Duration .between (timeSentCache , OffsetDateTime .now ());
138+ return roleApplicationSystemConfig .applicationSubmitCooldownMinutes ()
139+ - duration .toMinutes ();
140+ }
141+ return 0L ;
142+ }
132143}
0 commit comments