mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-23 12:06:41 +01:00
Better permission error in ChannelShutdownBehaviourModule
This commit is contained in:
parent
58929ce957
commit
a530753cac
@ -27,10 +27,7 @@ import com.discordsrv.common.function.OrDefault;
|
|||||||
import com.discordsrv.common.module.type.AbstractModule;
|
import com.discordsrv.common.module.type.AbstractModule;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.entities.IPermissionHolder;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
import net.dv8tion.jda.api.entities.PermissionOverride;
|
|
||||||
import net.dv8tion.jda.api.entities.Role;
|
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
|
||||||
import net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction;
|
import net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -115,8 +112,14 @@ public class ChannelShutdownBehaviourModule extends AbstractModule<DiscordSRV> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Guild guild = channel.getGuild();
|
||||||
|
if (!guild.getSelfMember().hasPermission(channel, Permission.MANAGE_PERMISSIONS)) {
|
||||||
|
logger().error("Cannot change permissions of " + channel + ": lacking \"Manage Permissions\" permission");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (everyone) {
|
if (everyone) {
|
||||||
setPermission(channel, channel.getGuild().getPublicRole(), permissions, state);
|
setPermission(channel, guild.getPublicRole(), permissions, state);
|
||||||
}
|
}
|
||||||
for (Long roleId : roleIds) {
|
for (Long roleId : roleIds) {
|
||||||
Role role = channel.getGuild().getRoleById(roleId);
|
Role role = channel.getGuild().getRoleById(roleId);
|
||||||
|
Loading…
Reference in New Issue
Block a user