Browse Source

add `AppliedTags` property

pull/2469/head
Misha133 2 years ago
parent
commit
c7a946c6eb
7 changed files with 36 additions and 3 deletions
  1. +9
    -0
      src/Discord.Net.Core/Entities/Channels/IThreadChannel.cs
  2. +7
    -1
      src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
  3. +4
    -1
      src/Discord.Net.Rest/API/Common/Channel.cs
  4. +4
    -0
      src/Discord.Net.Rest/API/Rest/ModifyThreadParams.cs
  5. +5
    -0
      src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs
  6. +2
    -1
      src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs
  7. +5
    -0
      src/Discord.Net.WebSocket/Entities/Channels/SocketThreadChannel.cs

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

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Discord
@@ -56,6 +57,14 @@ namespace Discord
/// </remarks>
bool? IsInvitable { get; }

/// <summary>
/// Gets ids of tags applied to a forum thread
/// </summary>
/// <remarks>
/// This property is only available on forum threads.
/// </remarks>
IReadOnlyCollection<ulong> AppliedTags { get; }

/// <summary>
/// Gets when the thread was created.
/// </summary>


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

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;

namespace Discord
{
@@ -53,6 +54,11 @@ namespace Discord
/// Gets or sets the auto archive duration.
/// </summary>
public Optional<ThreadArchiveDuration> AutoArchiveDuration { get; set; }

/// <summary>
/// Gets or sets the tags applied to a forum thread
/// </summary>
public Optional<IEnumerable<ulong>> AppliedTags { get; set; }

}
}

+ 4
- 1
src/Discord.Net.Rest/API/Common/Channel.cs View File

@@ -70,7 +70,10 @@ namespace Discord.API
//ForumChannel
[JsonProperty("available_tags")]
public Optional<ForumTags[]> ForumTags { get; set; }

[JsonProperty("applied_tags")]
public Optional<ulong[]> AppliedTags { get; set; }

[JsonProperty("default_auto_archive_duration")]
public Optional<ThreadArchiveDuration> AutoArchiveDuration { get; set; }
}


+ 4
- 0
src/Discord.Net.Rest/API/Rest/ModifyThreadParams.cs View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Discord.API.Rest
{
@@ -18,5 +19,8 @@ namespace Discord.API.Rest

[JsonProperty("rate_limit_per_user")]
public Optional<int> Slowmode { get; set; }

[JsonProperty("applied_tags")]
public Optional<IEnumerable<ulong>> AppliedTags { get; set; }
}
}

+ 5
- 0
src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs View File

@@ -37,6 +37,9 @@ namespace Discord.Rest
/// <inheritdoc/>
public bool? IsInvitable { get; private set; }

/// <inheritdoc/>
public IReadOnlyCollection<ulong> AppliedTags { get; private set; }

/// <inheritdoc cref="IThreadChannel.CreatedAt"/>
public override DateTimeOffset CreatedAt { get; }

@@ -77,6 +80,8 @@ namespace Discord.Rest
MessageCount = model.MessageCount.GetValueOrDefault(0);
Type = (ThreadType)model.Type;
ParentChannelId = model.CategoryId.Value;

AppliedTags = model.AppliedTags.GetValueOrDefault(Array.Empty<ulong>());
}

/// <summary>


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

@@ -57,7 +57,8 @@ namespace Discord.Rest
Archived = args.Archived,
AutoArchiveDuration = args.AutoArchiveDuration,
Locked = args.Locked,
Slowmode = args.SlowModeInterval
Slowmode = args.SlowModeInterval,
AppliedTags = args.AppliedTags
};
return await client.ApiClient.ModifyThreadAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
}


+ 5
- 0
src/Discord.Net.WebSocket/Entities/Channels/SocketThreadChannel.cs View File

@@ -89,6 +89,9 @@ namespace Discord.WebSocket
/// <inheritdoc/>
public bool? IsInvitable { get; private set; }

/// <inheritdoc/>
public IReadOnlyCollection<ulong> AppliedTags { get; private set; }

/// <inheritdoc cref="IThreadChannel.CreatedAt"/>
public override DateTimeOffset CreatedAt { get; }

@@ -149,6 +152,8 @@ namespace Discord.WebSocket
}

HasJoined = model.ThreadMember.IsSpecified;

AppliedTags = model.AppliedTags.GetValueOrDefault(Array.Empty<ulong>());
}

internal IReadOnlyCollection<SocketThreadUser> RemoveUsers(ulong[] users)


Loading…
Cancel
Save