discord-net / Discord.Net

An unofficial .Net wrapper for the Discord API (https://discord.com/)
https://discordnet.dev
MIT License
3.29k stars 741 forks source link

[Bug]: Cannot change channel permissions without Administrator #2834

Open joker-119 opened 7 months ago

joker-119 commented 7 months ago

Check The Docs

Verify Issue Source

Check your intents

Description

I'm unable to add a permission overwrite to a channel without giving the bot Administrator permissions.

I have all 3 Privileged gateway intents enabled.

The Voice -> Move Member permissions doesn't work.

I can give the bot every single permission on the server except admin, and it still does not work, but the moment I give it admin, it works perfectly.

Version

3.13.0

Working Version

No response

Logs

20:46:23 Gateway     A UserVoiceStateUpdated handler has thrown an unhandled exception.:
Discord.Net.HttpException: The server responded with error 50001: Missing Access
   at Discord.Net.Queue.RequestBucket.SendAsync(RestRequest request)
   at Discord.Net.Queue.RequestQueue.SendAsync(RestRequest request)
   at Discord.API.DiscordRestApiClient.SendInternalAsync(String method, String endpoint, RestRequest request)
   at Discord.Rest.RestGuildChannel.AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options)
   at Timbr.Modules.ChannelRenting.HandleJoined(SocketUser user, SocketVoiceState before, SocketVoiceState after) in /home/Joker/Projects/SilverCreek/Timbr/Timbr/Modules/ChannelRenting.cs:line 67
   at Timbr.Modules.ChannelRenting.OnVoiceStateChanged(SocketUser user, SocketVoiceState before, SocketVoiceState after) in /home/Joker/Projects/SilverCreek/Timbr/Timbr/Modules/ChannelRenting.cs:line 26
   at Discord.EventExtensions.InvokeAsync[T1,T2,T3](AsyncEvent`1 eventHandler, T1 arg1, T2 arg2, T3 arg3)
   at Discord.WebSocket.DiscordSocketClient.TimeoutWrap(String name, Func`1 action)

Sample

public void SubscribeEvents()
{
    Client.UserVoiceStateUpdated += ChannelRenting.OnVoiceStateChanged;
}

public void OnVoiceStateChanged(SocketUser user, SocketVoiceState before, SocketVoiceState after)
{
    if (after.VoiceChannel is not null)
        await after.VoiceChannel.AddPermissionOverwriteAsync((IGuildUser)user, new(connect: PermValue.Deny));
}

Packages

N/A

Environment

MCausc78 commented 7 months ago

This isnt discordnet issue, read error