@@ -156,6 +156,8 @@ public class BotDetectorPlugin extends Plugin
156
156
private static final String GET_AUTH_TOKEN_COMMAND = COMMAND_PREFIX + "GetToken" ;
157
157
private static final String SET_AUTH_TOKEN_COMMAND = COMMAND_PREFIX + "SetToken" ;
158
158
private static final String CLEAR_AUTH_TOKEN_COMMAND = COMMAND_PREFIX + "ClearToken" ;
159
+ private static final String TOGGLE_SHOW_DISCORD_VERIFICATION_ERRORS_COMMAND = COMMAND_PREFIX + "ToggleShowDiscordVerificationErrors" ;
160
+ private static final String TOGGLE_SHOW_DISCORD_VERIFICATION_ERRORS_COMMAND_ALIAS = COMMAND_PREFIX + "ToggleDVE" ;
159
161
160
162
/** Command to method map to be used in {@link #onCommandExecuted(CommandExecuted)}. **/
161
163
private final ImmutableMap <CaseInsensitiveString , Consumer <String []>> commandConsumerMap =
@@ -167,6 +169,8 @@ public class BotDetectorPlugin extends Plugin
167
169
.put (wrap (GET_AUTH_TOKEN_COMMAND ), s -> putAuthTokenIntoClipboardCommand ())
168
170
.put (wrap (SET_AUTH_TOKEN_COMMAND ), s -> setAuthTokenFromClipboardCommand ())
169
171
.put (wrap (CLEAR_AUTH_TOKEN_COMMAND ), s -> clearAuthTokenCommand ())
172
+ .put (wrap (TOGGLE_SHOW_DISCORD_VERIFICATION_ERRORS_COMMAND ), s -> toggleShowDiscordVerificationErrors ())
173
+ .put (wrap (TOGGLE_SHOW_DISCORD_VERIFICATION_ERRORS_COMMAND_ALIAS ), s -> toggleShowDiscordVerificationErrors ())
170
174
.build ();
171
175
172
176
private static final int MANUAL_FLUSH_COOLDOWN_SECONDS = 60 ;
@@ -759,9 +763,9 @@ else if (ex instanceof UnauthorizedTokenException)
759
763
{
760
764
sendChatStatusMessage ("Invalid token for Discord verification, cannot verify '" + author + "'." , true );
761
765
}
762
- else
766
+ else if ( config . showDiscordVerificationErrors ())
763
767
{
764
- sendChatStatusMessage ("Could not verify Discord for '" + author + "'." , true );
768
+ sendChatStatusMessage ("Could not verify Discord for '" + author + "'" + ( ex != null ? ": " + ex . getMessage () : "." ) , true );
765
769
}
766
770
});
767
771
}
@@ -1161,6 +1165,23 @@ private void clearAuthTokenCommand()
1161
1165
sendChatStatusMessage ("Auth token cleared." , true );
1162
1166
}
1163
1167
1168
+ /**
1169
+ * Toggles the config value in {@link BotDetectorConfig#showDiscordVerificationErrors()} and notifies the user of the change.
1170
+ */
1171
+ private void toggleShowDiscordVerificationErrors ()
1172
+ {
1173
+ boolean newVal = !config .showDiscordVerificationErrors ();
1174
+ config .setShowDiscordVerificationErrors (newVal );
1175
+ if (newVal )
1176
+ {
1177
+ sendChatStatusMessage ("Discord verification errors will now be shown in the chat" , true );
1178
+ }
1179
+ else
1180
+ {
1181
+ sendChatStatusMessage ("Discord verification errors will no longer be shown in the chat" , true );
1182
+ }
1183
+ }
1184
+
1164
1185
//endregion
1165
1186
1166
1187
0 commit comments