From caa69c12796f805e570a4d1d8ffc2bfa1b0d39bd Mon Sep 17 00:00:00 2001 From: duncte123 Date: Tue, 6 Apr 2021 17:36:46 +0200 Subject: [PATCH] Simplify statements --- .../guild/owner/settings/SettingsCommand.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/ml/duncte123/skybot/commands/guild/owner/settings/SettingsCommand.java b/src/main/java/ml/duncte123/skybot/commands/guild/owner/settings/SettingsCommand.java index 2c1079ec7..186520e63 100644 --- a/src/main/java/ml/duncte123/skybot/commands/guild/owner/settings/SettingsCommand.java +++ b/src/main/java/ml/duncte123/skybot/commands/guild/owner/settings/SettingsCommand.java @@ -663,20 +663,19 @@ private Role getFoundRoleOrNull(CommandContext ctx) { return null; } - final Role.RoleTags tags = foundRole.getTags(); + if (foundRole.isManaged()) { + final Role.RoleTags tags = foundRole.getTags(); + + if (tags.isBot()) { + sendMsg(ctx, "I cannot give this role to members because it belongs to <@" + tags.getBotIdLong() + '>'); + } else if (tags.isBoost()) { + sendMsg(ctx, "I cannot give the boost role to members"); + } else if (tags.isIntegration()) { + sendMsg(ctx, "I cannot give this role to members because it is managed by an integration (for example twitch subscriber roles)"); + } else { + sendMsg(ctx, "This role cannot be used, but I don't know why (`unknown managed role`)"); + } - if (tags.isBot()) { - sendMsg(ctx, "I cannot give this role to members because it belongs to <@" + tags.getBotIdLong() + '>'); - return null; - } - - if (tags.isBoost()) { - sendMsg(ctx, "I cannot give the boost role to members"); - return null; - } - - if (tags.isIntegration()) { - sendMsg(ctx, "I cannot give this role to members because it is managed by an integration (for example twitch subscriber roles)"); return null; }