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

Fix GuildPermission Modify, Add Missing Permission to AllowAll #866

Merged
merged 4 commits into from
Nov 6, 2017

Conversation

Chris-Johnston
Copy link
Collaborator

@Chris-Johnston Chris-Johnston commented Nov 1, 2017

I was told (by The Noodle Mummy#0339 and Spoopy Ghost Dog#5440) of an issue with GuildPermissions#Modify producing incorrect results. My discord handle is ChrisJ#8703.

This code snippet:

[Command("testing")]
public async Task testing(SocketRole role)
{
   await role.ModifyAsync(rp => rp.Permissions = Optional.Create(role.Permissions.Modify(changeNickname: false, manageNicknames: false)));
}

Would produce this result (as seen in Audit Logs):
image of audit log that shows denied change nickname and voice activity permissions

Now appears to be working correctly:
image of audit log showing denied permissions for change nickname and manage nicknames

Problem was caused by a parameter (manageRoles) out of order in GuildPermissions: https://github.com/RogueException/Discord.Net/blob/dev/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs#L135

In addition, I was also told that the following snippet:

SocketGuildChannel c = arg.GetTextChannel(313504029437329410);
OverwritePermissions perms = OverwritePermissions.AllowAll(c);
await c.AddPermissionOverwriteAsync(arg.GetUser(270390842923941888), perms);

would execute without problem, but was missing the WebHook permission. This is fixed in ChannelPermissions, and appears to be working properly now.
image

@foxbot foxbot merged commit dec7cb2 into discord-net:dev Nov 6, 2017
@Chris-Johnston Chris-Johnston deleted the fixPermissionModify branch November 6, 2017 03:46
FiniteReality pushed a commit to FiniteReality/Discord.Net that referenced this pull request May 5, 2018
…rd-net#866)

* Use named parameters in GuildPermission constructor, fix ordering of parmeters in Modify constructor call

* fix missing constructor parameter

* Added missing Webhook permission for the all text permissions value

* Resolves discord-net#869 Add UseExternalEmojis permission to GuildPermissions.All
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 this pull request may close these issues.

2 participants