@@ -47,7 +47,7 @@ public final class ModMailCommand extends SlashCommandAdapter {
4747 private static final Logger logger = LoggerFactory .getLogger (ModMailCommand .class );
4848 public static final String COMMAND_NAME = "modmail" ;
4949 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 " ;
5151 private static final String OPTION_GUILD = "server" ;
5252 private static final int COOLDOWN_DURATION_VALUE = 30 ;
5353 private static final ChronoUnit COOLDOWN_DURATION_UNIT = ChronoUnit .MINUTES ;
@@ -70,8 +70,9 @@ public ModMailCommand(JDA jda, Config config) {
7070
7171 OptionData guildOption = new OptionData (OptionType .STRING , OPTION_GUILD ,
7272 "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 );
7576
7677 List <Command .Choice > choices = jda .getGuildCache ()
7778 .stream ()
@@ -80,7 +81,7 @@ public ModMailCommand(JDA jda, Config config) {
8081
8182 guildOption .addChoices (choices );
8283
83- getData ().addOptions (guildOption , anonymousOption );
84+ getData ().addOptions (guildOption , revealNameOption );
8485
8586 modMailChannelNamePredicate =
8687 Pattern .compile (config .getModMailChannelPattern ()).asMatchPredicate ();
@@ -112,16 +113,16 @@ public void onSlashCommand(SlashCommandInteractionEvent event) {
112113
113114 private void sendMessageModal (SlashCommandInteractionEvent event ) {
114115 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 ();
116117
117118 TextInput message =
118119 TextInput .create (OPTION_MESSAGE , "Your message" , TextInputStyle .PARAGRAPH )
119120 .setPlaceholder ("What do you want to tell them?" )
120121 .setMinLength (3 )
121122 .build ();
122123
123- String componentId = generateComponentId ( String . valueOf ( userGuildId ),
124- String .valueOf (wantsToStayAnonymous ));
124+ String componentId =
125+ generateComponentId ( String .valueOf (userGuildId ), String . valueOf ( wantsToRevealName ));
125126
126127 Modal modal = Modal .create (componentId , "Send message to moderators" )
127128 .addActionRow (message )
@@ -136,7 +137,7 @@ public void onModalSubmitted(ModalInteractionEvent event, List<String> args) {
136137 long userId = event .getUser ().getIdLong ();
137138
138139 long userGuildId = Long .parseLong (args .getFirst ());
139- boolean wantsToStayAnonymous = Boolean .parseBoolean (args .get (1 ));
140+ boolean wantsToRevealName = Boolean .parseBoolean (args .get (1 ));
140141
141142 Optional <TextChannel > modMailAuditLog = getModMailChannel (event .getJDA (), userGuildId );
142143 if (modMailAuditLog .isEmpty ()) {
@@ -148,7 +149,7 @@ public void onModalSubmitted(ModalInteractionEvent event, List<String> args) {
148149
149150 event .deferReply ().setEphemeral (true ).queue ();
150151 MessageCreateAction message = createModMessage (event , userId , userMessage ,
151- wantsToStayAnonymous , modMailAuditLog .orElseThrow ());
152+ wantsToRevealName , modMailAuditLog .orElseThrow ());
152153
153154 sendMessage (event , message );
154155 }
@@ -172,11 +173,11 @@ private Optional<TextChannel> getModMailChannel(JDA jda, long guildId) {
172173 }
173174
174175 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 ;
177178 MessageCreateAction message =
178179 modMailAuditLog .sendMessageEmbeds (createModMailMessage (user , userMessage ));
179- if (! wantsToStayAnonymous ) {
180+ if (wantsToRevealName ) {
180181 message .addActionRow (DiscordClientAction .General .USER .asLinkButton ("Author Profile" ,
181182 String .valueOf (userId )));
182183 }
0 commit comments