File tree Expand file tree Collapse file tree 2 files changed +32
-8
lines changed
application/src/main/java/org/togetherjava/tjbot/commands/moderation/temp Expand file tree Collapse file tree 2 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,23 @@ final class TemporaryBanAction implements RevocableModerationAction {
39
39
long targetId ) {
40
40
if (failure instanceof ErrorResponseException errorResponseException ) {
41
41
if (errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_USER ) {
42
- logger .info (
42
+ logger .debug (
43
43
"Attempted to revoke a temporary ban but user '{}' does not exist anymore." ,
44
44
targetId );
45
45
return FailureIdentification .KNOWN ;
46
46
}
47
47
48
48
if (errorResponseException .getErrorResponse () == ErrorResponse .UNKNOWN_BAN ) {
49
- logger .info (
49
+ logger .debug (
50
50
"Attempted to revoke a temporary ban but the user '{}' is not banned anymore." ,
51
51
targetId );
52
52
return FailureIdentification .KNOWN ;
53
53
}
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
+ }
54
59
}
55
60
return FailureIdentification .UNKNOWN ;
56
61
}
Original file line number Diff line number Diff line change @@ -41,12 +41,31 @@ final class TemporaryMuteAction implements RevocableModerationAction {
41
41
@ Override
42
42
public @ NotNull FailureIdentification handleRevokeFailure (@ NotNull Throwable failure ,
43
43
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
+ }
50
69
}
51
70
return FailureIdentification .UNKNOWN ;
52
71
}
You can’t perform that action at this time.
0 commit comments