@@ -47,7 +47,7 @@ public final class ModMailCommand extends SlashCommandAdapter {
47
47
private static final Logger logger = LoggerFactory .getLogger (ModMailCommand .class );
48
48
public static final String COMMAND_NAME = "modmail" ;
49
49
private static final String OPTION_MESSAGE = "message" ;
50
- private static final String OPTION_STAY_ANONYMOUS = "stay-anonymous " ;
50
+ private static final String OPTION_REVEAL_NAME = "reveal-name " ;
51
51
private static final String OPTION_GUILD = "server" ;
52
52
private static final int COOLDOWN_DURATION_VALUE = 30 ;
53
53
private static final ChronoUnit COOLDOWN_DURATION_UNIT = ChronoUnit .MINUTES ;
@@ -70,8 +70,9 @@ public ModMailCommand(JDA jda, Config config) {
70
70
71
71
OptionData guildOption = new OptionData (OptionType .STRING , OPTION_GUILD ,
72
72
"The server to contact mods from" , true );
73
- OptionData anonymousOption = new OptionData (OptionType .BOOLEAN , OPTION_STAY_ANONYMOUS ,
74
- "If set, your name is hidden - note that mods then can not get back to you" , true );
73
+ OptionData revealNameOption = new OptionData (OptionType .BOOLEAN , OPTION_REVEAL_NAME ,
74
+ "If set, your name is shown to mods - false means mods can not get back to you" ,
75
+ true );
75
76
76
77
List <Command .Choice > choices = jda .getGuildCache ()
77
78
.stream ()
@@ -80,7 +81,7 @@ public ModMailCommand(JDA jda, Config config) {
80
81
81
82
guildOption .addChoices (choices );
82
83
83
- getData ().addOptions (guildOption , anonymousOption );
84
+ getData ().addOptions (guildOption , revealNameOption );
84
85
85
86
modMailChannelNamePredicate =
86
87
Pattern .compile (config .getModMailChannelPattern ()).asMatchPredicate ();
@@ -112,16 +113,16 @@ public void onSlashCommand(SlashCommandInteractionEvent event) {
112
113
113
114
private void sendMessageModal (SlashCommandInteractionEvent event ) {
114
115
long userGuildId = event .getOption (OPTION_GUILD ).getAsLong ();
115
- boolean wantsToStayAnonymous = event .getOption (OPTION_STAY_ANONYMOUS ).getAsBoolean ();
116
+ boolean wantsToRevealName = event .getOption (OPTION_REVEAL_NAME ).getAsBoolean ();
116
117
117
118
TextInput message =
118
119
TextInput .create (OPTION_MESSAGE , "Your message" , TextInputStyle .PARAGRAPH )
119
120
.setPlaceholder ("What do you want to tell them?" )
120
121
.setMinLength (3 )
121
122
.build ();
122
123
123
- String componentId = generateComponentId ( String . valueOf ( userGuildId ),
124
- String .valueOf (wantsToStayAnonymous ));
124
+ String componentId =
125
+ generateComponentId ( String .valueOf (userGuildId ), String . valueOf ( wantsToRevealName ));
125
126
126
127
Modal modal = Modal .create (componentId , "Send message to moderators" )
127
128
.addActionRow (message )
@@ -136,7 +137,7 @@ public void onModalSubmitted(ModalInteractionEvent event, List<String> args) {
136
137
long userId = event .getUser ().getIdLong ();
137
138
138
139
long userGuildId = Long .parseLong (args .getFirst ());
139
- boolean wantsToStayAnonymous = Boolean .parseBoolean (args .get (1 ));
140
+ boolean wantsToRevealName = Boolean .parseBoolean (args .get (1 ));
140
141
141
142
Optional <TextChannel > modMailAuditLog = getModMailChannel (event .getJDA (), userGuildId );
142
143
if (modMailAuditLog .isEmpty ()) {
@@ -148,7 +149,7 @@ public void onModalSubmitted(ModalInteractionEvent event, List<String> args) {
148
149
149
150
event .deferReply ().setEphemeral (true ).queue ();
150
151
MessageCreateAction message = createModMessage (event , userId , userMessage ,
151
- wantsToStayAnonymous , modMailAuditLog .orElseThrow ());
152
+ wantsToRevealName , modMailAuditLog .orElseThrow ());
152
153
153
154
sendMessage (event , message );
154
155
}
@@ -172,11 +173,11 @@ private Optional<TextChannel> getModMailChannel(JDA jda, long guildId) {
172
173
}
173
174
174
175
private MessageCreateAction createModMessage (ModalInteractionEvent event , long userId ,
175
- String userMessage , boolean wantsToStayAnonymous , TextChannel modMailAuditLog ) {
176
- User user = wantsToStayAnonymous ? null : event .getUser ();
176
+ String userMessage , boolean wantsToRevealName , TextChannel modMailAuditLog ) {
177
+ User user = wantsToRevealName ? event .getUser () : null ;
177
178
MessageCreateAction message =
178
179
modMailAuditLog .sendMessageEmbeds (createModMailMessage (user , userMessage ));
179
- if (! wantsToStayAnonymous ) {
180
+ if (wantsToRevealName ) {
180
181
message .addActionRow (DiscordClientAction .General .USER .asLinkButton ("Author Profile" ,
181
182
String .valueOf (userId )));
182
183
}
0 commit comments