check if a text channel is private? java jda dv8tion

So I found out a way to detect private channels now. Just gonna send this here for anyone else who encounters my issue

    public void onMessageReceived(MessageReceivedEvent e) {

PermissionOverride po = e.getTextChannel().getPermissionOverride((IPermissionHolder) e.getGuild().getRolesByName("@everyone", true).toArray() [0]);
if (po != null && po.getDenied().contains(Permission.MESSAGE_READ)) {
                //System.out.println("locked channel");

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top