create music role if owner wants permissions for users to use music

This commit is contained in:
Venal 2018-02-25 19:15:38 -05:00
parent e0d66b816d
commit 8d465db01c

View File

@ -82,6 +82,16 @@ public class DiscordUtils {
}); });
return roles; return roles;
} }
public static boolean roleExists(Guild guild, String name) {
List<Role> roles = roleSearch(guild, name);
return roles == null;
}
public static boolean roleExists(Guild guild, Role role) {
return roleExists(guild, role.getName());
}
public static Role getMentionedRole(Guild guild, String string) { public static Role getMentionedRole(Guild guild, String string) {
Role mentionedRole = null; Role mentionedRole = null;
@ -144,4 +154,16 @@ public class DiscordUtils {
Permission.MESSAGE_WRITE)).queue()); Permission.MESSAGE_WRITE)).queue());
return role; return role;
} }
// Create this role is owner requests users must have permission for using music
public static Role createMusicRole(Guild guild) {
// Don't need to do anything with permissions as we're assuming users have basic perms
Role musicRole = guild.getController().createRole().setName("Music").setColor(Color.BLACK).setMentionable(false).complete();
if(roleExists(guild, musicRole)) {
// Will probably remove this and check roleExists directly where it's needed
return null; // yeah yeah ik
}
return musicRole;
}
} }