Skip to content

Commit caa69c1

Browse files
committed
Simplify statements
1 parent 665dfb1 commit caa69c1

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/main/java/ml/duncte123/skybot/commands/guild/owner/settings/SettingsCommand.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -663,20 +663,19 @@ private Role getFoundRoleOrNull(CommandContext ctx) {
663663
return null;
664664
}
665665

666-
final Role.RoleTags tags = foundRole.getTags();
666+
if (foundRole.isManaged()) {
667+
final Role.RoleTags tags = foundRole.getTags();
668+
669+
if (tags.isBot()) {
670+
sendMsg(ctx, "I cannot give this role to members because it belongs to <@" + tags.getBotIdLong() + '>');
671+
} else if (tags.isBoost()) {
672+
sendMsg(ctx, "I cannot give the boost role to members");
673+
} else if (tags.isIntegration()) {
674+
sendMsg(ctx, "I cannot give this role to members because it is managed by an integration (for example twitch subscriber roles)");
675+
} else {
676+
sendMsg(ctx, "This role cannot be used, but I don't know why (`unknown managed role`)");
677+
}
667678

668-
if (tags.isBot()) {
669-
sendMsg(ctx, "I cannot give this role to members because it belongs to <@" + tags.getBotIdLong() + '>');
670-
return null;
671-
}
672-
673-
if (tags.isBoost()) {
674-
sendMsg(ctx, "I cannot give the boost role to members");
675-
return null;
676-
}
677-
678-
if (tags.isIntegration()) {
679-
sendMsg(ctx, "I cannot give this role to members because it is managed by an integration (for example twitch subscriber roles)");
680679
return null;
681680
}
682681

0 commit comments

Comments
 (0)