Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreadChannel perm checks checking for Manage_Channel #2188

Closed
3 tasks done
Vrontis opened this issue Jul 22, 2022 · 1 comment
Closed
3 tasks done

ThreadChannel perm checks checking for Manage_Channel #2188

Vrontis opened this issue Jul 22, 2022 · 1 comment

Comments

@Vrontis
Copy link

Vrontis commented Jul 22, 2022

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have updated to the latest JDA version
  • I have checked the branches or the maintainers' PRs for upcoming bug fixes.

Expected Behaviour

JDA should only check for the Manage_Threads permission, on edit/delete related perm checks on ThreadChannels, not also for Manage_Channel.
Tested needed permissions on regular Discord client & on non-JDA bots.

Code Example for Reproduction Steps

public void threadPermExample(ThreadChannel threadChannel) {
    // Here the .getManager() throws the the InsufficientPermissionException, effectively calling
    // net.dv8tion.jda.internal.managers.channel.ChannelManagerImpl#checkPermissions
    threadChannel.getManager().setArchived(false).complete();

    // Here it's .delete()
    // net.dv8tion.jda.internal.entities.mixin.channel.middleman.GuildChannelMixin#delete
    threadChannel.delete().queue();
}

Code for JDABuilder or DefaultShardManagerBuilder used

api = JDABuilder.createDefault(config.getAuthToken()).addEventListeners(
                client,
                new GuildListener(),
                new ThreadListener()
        ).enableIntents(GatewayIntent.GUILD_MEMBERS).build();

Exception or Error

net.dv8tion.jda.api.exceptions.InsufficientPermissionException: Cannot perform action due to a lack of Permission. Missing permission: MANAGE_CHANNEL
	at net.dv8tion.jda.internal.managers.channel.ChannelManagerImpl.checkPermissions(ChannelManagerImpl.java:575)
	at net.dv8tion.jda.internal.managers.channel.ChannelManagerImpl.<init>(ChannelManagerImpl.java:79)
	at net.dv8tion.jda.internal.managers.channel.concrete.ThreadChannelManagerImpl.<init>(ThreadChannelManagerImpl.java:27)
	at net.dv8tion.jda.internal.entities.ThreadChannelImpl.getManager(ThreadChannelImpl.java:280)
	at dev.vrontis.quickbot.listener.GuildListener.lambda$onChannelUpdateArchived$0(GuildListener.java:38)
@MinnDevelopment
Copy link
Member

Resolved by 5.0.0-alpha.19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants