File tree Expand file tree Collapse file tree
application/src/main/java/org/togetherjava/tjbot/commands/moderation/temp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,18 +39,23 @@ final class TemporaryBanAction implements RevocableModerationAction {
3939 long targetId ) {
4040 if (failure instanceof ErrorResponseException errorResponseException ) {
4141 if (errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_USER ) {
42- logger .info (
42+ logger .debug (
4343 "Attempted to revoke a temporary ban but user '{}' does not exist anymore." ,
4444 targetId );
4545 return FailureIdentification .KNOWN ;
4646 }
4747
4848 if (errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_BAN ) {
49- logger .info (
49+ logger .debug (
5050 "Attempted to revoke a temporary ban but the user '{}' is not banned anymore." ,
5151 targetId );
5252 return FailureIdentification .KNOWN ;
5353 }
54+
55+ if (errorResponseException .getErrorResponse () == ErrorResponse .MISSING_PERMISSIONS ) {
56+ logger .warn ("Attempted to revoke a temporary ban but the bot lacks permission." );
57+ return FailureIdentification .KNOWN ;
58+ }
5459 }
5560 return FailureIdentification .UNKNOWN ;
5661 }
Original file line number Diff line number Diff line change @@ -41,12 +41,31 @@ final class TemporaryMuteAction implements RevocableModerationAction {
4141 @ Override
4242 public @ NotNull FailureIdentification handleRevokeFailure (@ NotNull Throwable failure ,
4343 long targetId ) {
44- if (failure instanceof ErrorResponseException errorResponseException
45- && errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_USER ) {
46- logger .info (
47- "Attempted to revoke a temporary mute but user '{}' does not exist anymore." ,
48- targetId );
49- return FailureIdentification .KNOWN ;
44+ if (failure instanceof ErrorResponseException errorResponseException ) {
45+ if (errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_USER ) {
46+ logger .debug (
47+ "Attempted to revoke a temporary mute but user '{}' does not exist anymore." ,
48+ targetId );
49+ return FailureIdentification .KNOWN ;
50+ }
51+
52+ if (errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_MEMBER ) {
53+ logger .debug (
54+ "Attempted to revoke a temporary mute but user '{}' is not a member of the guild anymore." ,
55+ targetId );
56+ return FailureIdentification .KNOWN ;
57+ }
58+
59+ if (errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_ROLE ) {
60+ logger .warn (
61+ "Attempted to revoke a temporary mute but the mute role can not be found." );
62+ return FailureIdentification .KNOWN ;
63+ }
64+
65+ if (errorResponseException .getErrorResponse () == ErrorResponse .MISSING_PERMISSIONS ) {
66+ logger .warn ("Attempted to revoke a temporary mute but the bot lacks permission." );
67+ return FailureIdentification .KNOWN ;
68+ }
5069 }
5170 return FailureIdentification .UNKNOWN ;
5271 }
You can’t perform that action at this time.
0 commit comments