@@ -156,6 +156,8 @@ public class BotDetectorPlugin extends Plugin
156156 private static final String GET_AUTH_TOKEN_COMMAND = COMMAND_PREFIX + "GetToken" ;
157157 private static final String SET_AUTH_TOKEN_COMMAND = COMMAND_PREFIX + "SetToken" ;
158158 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" ;
159161
160162 /** Command to method map to be used in {@link #onCommandExecuted(CommandExecuted)}. **/
161163 private final ImmutableMap <CaseInsensitiveString , Consumer <String []>> commandConsumerMap =
@@ -167,6 +169,8 @@ public class BotDetectorPlugin extends Plugin
167169 .put (wrap (GET_AUTH_TOKEN_COMMAND ), s -> putAuthTokenIntoClipboardCommand ())
168170 .put (wrap (SET_AUTH_TOKEN_COMMAND ), s -> setAuthTokenFromClipboardCommand ())
169171 .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 ())
170174 .build ();
171175
172176 private static final int MANUAL_FLUSH_COOLDOWN_SECONDS = 60 ;
@@ -759,9 +763,9 @@ else if (ex instanceof UnauthorizedTokenException)
759763 {
760764 sendChatStatusMessage ("Invalid token for Discord verification, cannot verify '" + author + "'." , true );
761765 }
762- else
766+ else if ( config . showDiscordVerificationErrors ())
763767 {
764- sendChatStatusMessage ("Could not verify Discord for '" + author + "'." , true );
768+ sendChatStatusMessage ("Could not verify Discord for '" + author + "'" + ( ex != null ? ": " + ex . getMessage () : "." ) , true );
765769 }
766770 });
767771 }
@@ -1161,6 +1165,23 @@ private void clearAuthTokenCommand()
11611165 sendChatStatusMessage ("Auth token cleared." , true );
11621166 }
11631167
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+
11641185 //endregion
11651186
11661187
0 commit comments