1
1
package org .togetherjava .tjbot .commands .reminder ;
2
2
3
3
import net .dv8tion .jda .api .entities .Member ;
4
- import net .dv8tion .jda .api .events .interaction .SlashCommandEvent ;
4
+ import net .dv8tion .jda .api .events .interaction .command . SlashCommandInteractionEvent ;
5
5
import org .jetbrains .annotations .NotNull ;
6
6
import org .junit .jupiter .api .Assertions ;
7
7
import org .junit .jupiter .api .BeforeEach ;
@@ -35,14 +35,14 @@ void setUp() {
35
35
rawReminders = new RawReminderTestHelper (database , jdaTester );
36
36
}
37
37
38
- private @ NotNull SlashCommandEvent triggerSlashCommand (int timeAmount , @ NotNull String timeUnit ,
39
- @ NotNull String content ) {
38
+ private @ NotNull SlashCommandInteractionEvent triggerSlashCommand (int timeAmount ,
39
+ @ NotNull String timeUnit , @ NotNull String content ) {
40
40
return triggerSlashCommand (timeAmount , timeUnit , content , jdaTester .getMemberSpy ());
41
41
}
42
42
43
- private @ NotNull SlashCommandEvent triggerSlashCommand (int timeAmount , @ NotNull String timeUnit ,
44
- @ NotNull String content , @ NotNull Member author ) {
45
- SlashCommandEvent event = jdaTester .createSlashCommandEvent (command )
43
+ private @ NotNull SlashCommandInteractionEvent triggerSlashCommand (int timeAmount ,
44
+ @ NotNull String timeUnit , @ NotNull String content , @ NotNull Member author ) {
45
+ SlashCommandInteractionEvent event = jdaTester .createSlashCommandInteractionEvent (command )
46
46
.setOption (RemindCommand .TIME_AMOUNT_OPTION , timeAmount )
47
47
.setOption (RemindCommand .TIME_UNIT_OPTION , timeUnit )
48
48
.setOption (RemindCommand .CONTENT_OPTION , content )
@@ -70,7 +70,7 @@ void throwsWhenGivenUnsupportedUnit() {
70
70
void doesNotSupportDatesTooFarInFuture () {
71
71
// GIVEN
72
72
// WHEN triggering /remind too far in the future
73
- SlashCommandEvent event = triggerSlashCommand (10 , "years" , "foo" );
73
+ SlashCommandInteractionEvent event = triggerSlashCommand (10 , "years" , "foo" );
74
74
75
75
// THEN rejects and responds accordingly, no reminder was created
76
76
verify (event ).reply (startsWith ("The reminder is set too far in the future" ));
@@ -87,7 +87,7 @@ void userIsLimitedIfTooManyPendingReminders() {
87
87
}
88
88
89
89
// WHEN triggering another reminder
90
- SlashCommandEvent event = triggerSlashCommand (5 , "minutes" , "foo" );
90
+ SlashCommandInteractionEvent event = triggerSlashCommand (5 , "minutes" , "foo" );
91
91
92
92
// THEN rejects and responds accordingly, no new reminder was created
93
93
verify (event )
@@ -110,7 +110,7 @@ void userIsNotLimitedIfOtherUserHasTooManyPendingReminders() {
110
110
Member secondUser = jdaTester .createMemberSpy (2 );
111
111
112
112
// WHEN the second user triggers another reminder
113
- SlashCommandEvent event = triggerSlashCommand (5 , "minutes" , "foo" , secondUser );
113
+ SlashCommandInteractionEvent event = triggerSlashCommand (5 , "minutes" , "foo" , secondUser );
114
114
115
115
// THEN accepts the reminder and responds accordingly
116
116
verify (event ).reply ("Will remind you about 'foo' in 5 minutes." );
@@ -125,7 +125,7 @@ void userIsNotLimitedIfOtherUserHasTooManyPendingReminders() {
125
125
void canCreateReminders () {
126
126
// GIVEN
127
127
// WHEN triggering the /remind command
128
- SlashCommandEvent event = triggerSlashCommand (5 , "minutes" , "foo" );
128
+ SlashCommandInteractionEvent event = triggerSlashCommand (5 , "minutes" , "foo" );
129
129
130
130
// THEN accepts the reminder and responds accordingly
131
131
verify (event ).reply ("Will remind you about 'foo' in 5 minutes." );
0 commit comments