Hopefully finished help command

This commit is contained in:
Stijn
2022-03-09 22:37:44 +01:00
parent 9f1f62d593
commit ba55956bbf
6 changed files with 91 additions and 24 deletions
@@ -24,28 +24,16 @@ public class PermissionManager {
this.privateEnabledCommands = privateEnabledCommands;
}
public boolean hasPermission(TextChannel textChannel, User user, String permission) {
public boolean hasPermission(TextChannel textChannel, long userId, List<Long> groupIds, String permission) {
permission = permission.toLowerCase();
if (textChannel instanceof PrivateChannel) {
if (isDisabled(privateEnabledCommands, permission))
return false;
return hasPermission(user.getIdLong(), null, permission);
} else {
Logger.warning("Using user for Guild channel % ", textChannel.getAsMention());
return false;
if (isDisabled(channelEnabledCommands.get(textChannel.getIdLong()), permission.toLowerCase()))
return false;
}
}
public boolean hasPermission(TextChannel textChannel, Member member, String permission) {
permission = permission.toLowerCase();
if (isDisabled(channelEnabledCommands.get(textChannel.getIdLong()), permission.toLowerCase()))
return false;
return hasPermission(
member.getIdLong(),
member.getRoles().stream()
.map(Role::getIdLong)
.collect(Collectors.toList()),
permission);
return hasPermission(userId, groupIds, permission);
}
private boolean isDisabled(List<String> enabledCommandList, String permission) {