Browse Source

fix: Voice overwrites and CategoryId remarks (#1608)

* Add overwrites to voice and change CategoryId docs

* Let's not forget another one
tags/2.3.0
Paulo GitHub 4 years ago
parent
commit
43c8fc0535
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
  2. +20
    -2
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs View File

@@ -28,7 +28,7 @@ namespace Discord
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
public Optional<ulong?> CategoryId { get; set; }


+ 20
- 2
src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs View File

@@ -28,7 +28,16 @@ namespace Discord.Rest
{
Name = args.Name,
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);
}
@@ -70,7 +79,16 @@ namespace Discord.Rest
Name = args.Name,
Position = args.Position,
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);
}


Loading…
Cancel
Save