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

Bot can't delete voice channel even with MANAGE_CHANNEL #2678

Closed
2 tasks done
mfawcett opened this issue May 11, 2024 · 2 comments · Fixed by #2679
Closed
2 tasks done

Bot can't delete voice channel even with MANAGE_CHANNEL #2678

mfawcett opened this issue May 11, 2024 · 2 comments · Fixed by #2679

Comments

@mfawcett
Copy link

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have checked for PRs that might already address this issue.

Version of JDA

5.0.0-beta.23

Expected Behaviour

Delete the voice channel

Code Example for Reproduction Steps

Category category = guild.createCategory("test")
	.addRolePermissionOverride(guild.getPublicRole().getIdLong(), null, EnumSet.of(Permission.VIEW_CHANNEL))
	.addRolePermissionOverride(guild.getBotRole().getIdLong(), EnumSet.of(Permission.VIEW_CHANNEL, Permission.MANAGE_CHANNEL), null)
	.complete();

VoiceChannel vc = guild
	.createVoiceChannel("hello", category)
	.setBitrate(guild.getMaxBitrate())
	.complete();

vc.delete().complete();

Code for JDABuilder or DefaultShardManagerBuilder used

builder
            .enableIntents(GatewayIntent.GUILD_MEMBERS, GatewayIntent.MESSAGE_CONTENT)
            .setMemberCachePolicy(MemberCachePolicy.ALL)
            .setEventManagerProvider(id -> eventManager)
            .setBulkDeleteSplittingEnabled(false)
            .setActivity(Activity.playing("Picking Teams"))
            .disableCache(CacheFlag.ACTIVITY, CacheFlag.MEMBER_OVERRIDES, CacheFlag.VOICE_STATE);

        // Disable member chunking on startup
        builder.setChunkingFilter(ChunkingFilter.NONE);

        // Disable presence updates and typing events
        builder.disableIntents(GatewayIntent.GUILD_PRESENCES, GatewayIntent.GUILD_MESSAGE_TYPING);

        // Consider guilds with more than 50 members as "large".
        // Large guilds will only provide online members in their setup and thus reduce bandwidth if chunking is disabled.
        builder.setLargeThreshold(50);

Exception or Error

[ForkJoinPool.commonPool-worker-1] ERROR RestAction - Encountered error while processing success consumer
net.dv8tion.jda.api.exceptions.InsufficientPermissionException: Cannot perform action due to a lack of Permission. Missing permission: MANAGE_CHANNEL
	at net.dv8tion.jda.internal.entities.channel.mixin.middleman.GuildChannelMixin.checkPermission(GuildChannelMixin.java:64)
	at net.dv8tion.jda.internal.entities.channel.mixin.middleman.GuildChannelMixin.checkPermission(GuildChannelMixin.java:56)
	at net.dv8tion.jda.internal.entities.channel.mixin.middleman.GuildChannelMixin.checkCanManage(GuildChannelMixin.java:71)
	at net.dv8tion.jda.internal.entities.channel.mixin.middleman.GuildChannelMixin.delete(GuildChannelMixin.java:43)
@MinnDevelopment
Copy link
Member

Does your bot have the VOICE_CONNECT permission in this channel? It is a required permission to have access to the channel in the first place.

@mfawcett
Copy link
Author

Confirmed that adding VOICE_CONNECT fixes the issue.

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

Successfully merging a pull request may close this issue.

2 participants