fix: Voice overwrites and CategoryId remarks (#1608)

* Add overwrites to voice and change CategoryId docs

* Let's not forget another one
This commit is contained in:
Paulo
2020-10-28 17:51:16 -03:00
committed by GitHub
parent 03b831e691
commit 43c8fc0535
2 changed files with 21 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ namespace Discord
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Setting this value to a category's snowflake identifier will change or set this channel's parent to the /// Setting this value to a category's snowflake identifier will change or set this channel's parent to the
/// specified channel; setting this value to <c>0</c> will detach this channel from its parent if one /// specified channel; setting this value to <see langword="null"/> will detach this channel from its parent if one
/// is set. /// is set.
/// </remarks> /// </remarks>
public Optional<ulong?> CategoryId { get; set; } public Optional<ulong?> CategoryId { get; set; }

View File

@@ -28,7 +28,16 @@ namespace Discord.Rest
{ {
Name = args.Name, Name = args.Name,
Position = args.Position, Position = args.Position,
CategoryId = args.CategoryId CategoryId = args.CategoryId,
Overwrites = args.PermissionOverwrites.IsSpecified
? args.PermissionOverwrites.Value.Select(overwrite => new API.Overwrite
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
Allow = overwrite.Permissions.AllowValue,
Deny = overwrite.Permissions.DenyValue
}).ToArray()
: Optional.Create<API.Overwrite[]>(),
}; };
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false); return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
} }
@@ -70,7 +79,16 @@ namespace Discord.Rest
Name = args.Name, Name = args.Name,
Position = args.Position, Position = args.Position,
CategoryId = args.CategoryId, CategoryId = args.CategoryId,
UserLimit = args.UserLimit.IsSpecified ? (args.UserLimit.Value ?? 0) : Optional.Create<int>() UserLimit = args.UserLimit.IsSpecified ? (args.UserLimit.Value ?? 0) : Optional.Create<int>(),
Overwrites = args.PermissionOverwrites.IsSpecified
? args.PermissionOverwrites.Value.Select(overwrite => new API.Overwrite
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
Allow = overwrite.Permissions.AllowValue,
Deny = overwrite.Permissions.DenyValue
}).ToArray()
: Optional.Create<API.Overwrite[]>(),
}; };
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false); return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
} }