Browse Source

Merge 102aa0c05d into 4fa6393329

pull/1282/merge
Chris Johnston GitHub 5 years ago
parent
commit
c2231082e0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 18 deletions
  1. +0
    -9
      src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
  2. +18
    -0
      src/Discord.Net.Core/Entities/Channels/NestedChannelProperties.cs
  3. +1
    -1
      src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
  4. +1
    -1
      src/Discord.Net.Core/Entities/Channels/VoiceChannelProperties.cs
  5. +0
    -2
      src/Discord.Net.Rest/API/Rest/ModifyGuildChannelParams.cs
  6. +12
    -0
      src/Discord.Net.Rest/API/Rest/ModifyNestedChannelParams.cs
  7. +1
    -1
      src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs
  8. +2
    -2
      src/Discord.Net.Rest/API/Rest/ModifyVoiceChannelParams.cs
  9. +1
    -2
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs

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

@@ -21,14 +21,5 @@ namespace Discord
/// Moves the channel to the following position. This property is zero-based.
/// </summary>
public Optional<int> Position { get; set; }
/// <summary>
/// Gets or sets the category ID for this channel.
/// </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
/// is set.
/// </remarks>
public Optional<ulong?> CategoryId { get; set; }
}
}

+ 18
- 0
src/Discord.Net.Core/Entities/Channels/NestedChannelProperties.cs View File

@@ -0,0 +1,18 @@
namespace Discord
{
/// <summary>
/// Properties that are used to modify an <see cref="INestedChannel"/> with the specified changes.
/// </summary>
public class NestedChannelProperties : GuildChannelProperties
{
/// <summary>
/// Gets or sets the category ID for this channel.
/// </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>null</c> will detach this channel from its parent if one
/// is set.
/// </remarks>
public Optional<ulong?> CategoryId { get; set; }
}
}

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

@@ -6,7 +6,7 @@ namespace Discord
/// Provides properties that are used to modify an <see cref="ITextChannel"/> with the specified changes.
/// </summary>
/// <seealso cref="ITextChannel.ModifyAsync(System.Action{TextChannelProperties}, RequestOptions)"/>
public class TextChannelProperties : GuildChannelProperties
public class TextChannelProperties : NestedChannelProperties
{
/// <summary>
/// Gets or sets the topic of the channel.


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

@@ -3,7 +3,7 @@ namespace Discord
/// <summary>
/// Provides properties that are used to modify an <see cref="IVoiceChannel" /> with the specified changes.
/// </summary>
public class VoiceChannelProperties : GuildChannelProperties
public class VoiceChannelProperties : NestedChannelProperties
{
/// <summary>
/// Gets or sets the bitrate of the voice connections in this channel. Must be greater than 8000.


+ 0
- 2
src/Discord.Net.Rest/API/Rest/ModifyGuildChannelParams.cs View File

@@ -10,8 +10,6 @@ namespace Discord.API.Rest
public Optional<string> Name { get; set; }
[JsonProperty("position")]
public Optional<int> Position { get; set; }
[JsonProperty("parent_id")]
public Optional<ulong?> CategoryId { get; set; }
[JsonProperty("permission_overwrites")]
public Optional<Overwrite[]> Overwrites { get; set; }
}


+ 12
- 0
src/Discord.Net.Rest/API/Rest/ModifyNestedChannelParams.cs View File

@@ -0,0 +1,12 @@
#pragma warning disable CS1591
using Newtonsoft.Json;

namespace Discord.API.Rest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
internal class ModifyNestedChannelParams : ModifyGuildChannelParams
{
[JsonProperty("parent_id")]
public Optional<ulong?> CategoryId { get; set; }
}
}

+ 1
- 1
src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs View File

@@ -4,7 +4,7 @@ using Newtonsoft.Json;
namespace Discord.API.Rest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
internal class ModifyTextChannelParams : ModifyGuildChannelParams
internal class ModifyTextChannelParams : ModifyNestedChannelParams
{
[JsonProperty("topic")]
public Optional<string> Topic { get; set; }


+ 2
- 2
src/Discord.Net.Rest/API/Rest/ModifyVoiceChannelParams.cs View File

@@ -1,10 +1,10 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using Newtonsoft.Json;

namespace Discord.API.Rest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
internal class ModifyVoiceChannelParams : ModifyGuildChannelParams
internal class ModifyVoiceChannelParams : ModifyNestedChannelParams
{
[JsonProperty("bitrate")]
public Optional<int> Bitrate { get; set; }


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

@@ -27,8 +27,7 @@ namespace Discord.Rest
var apiArgs = new API.Rest.ModifyGuildChannelParams
{
Name = args.Name,
Position = args.Position,
CategoryId = args.CategoryId
Position = args.Position
};
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
}


Loading…
Cancel
Save