Browse Source

add `Moderated` property to `ForumTag``

pull/2469/head
Misha133 2 years ago
parent
commit
340faa129a
4 changed files with 13 additions and 3 deletions
  1. +8
    -1
      src/Discord.Net.Core/Entities/ForumTag.cs
  2. +3
    -0
      src/Discord.Net.Rest/API/Common/ForumTags.cs
  3. +1
    -1
      src/Discord.Net.Rest/Entities/Channels/RestForumChannel.cs
  4. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketForumChannel.cs

+ 8
- 1
src/Discord.Net.Core/Entities/ForumTag.cs View File

@@ -26,7 +26,13 @@ namespace Discord
/// </summary>
public IEmote Emoji { get; }

internal ForumTag(ulong id, string name, ulong? emojiId, string emojiName)
/// <summary>
/// Gets whether this tag can only be added to or removed from threads by a member
/// with the <see cref="GuildPermissions.ManageThreads"/> permission
/// </summary>
public bool Moderated { get; }

internal ForumTag(ulong id, string name, ulong? emojiId, string emojiName, bool moderated)
{
if (emojiId.HasValue && emojiId.Value != 0)
Emoji = new Emote(emojiId.Value, emojiName, false);
@@ -37,6 +43,7 @@ namespace Discord

Id = id;
Name = name;
Moderated = moderated;
}
}
}

+ 3
- 0
src/Discord.Net.Rest/API/Common/ForumTags.cs View File

@@ -17,5 +17,8 @@ namespace Discord.API
public Optional<ulong?> EmojiId { get; set; }
[JsonProperty("emoji_name")]
public Optional<string> EmojiName { get; set; }

[JsonProperty("moderated")]
public bool Moderated { get; set; }
}
}

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

@@ -62,7 +62,7 @@ namespace Discord.Rest
ThreadCreationInterval = model.SlowMode.Value;

Tags = model.ForumTags.GetValueOrDefault(Array.Empty<API.ForumTags>()).Select(
x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault())
x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault(), x.Moderated)
).ToImmutableArray();
}



+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketForumChannel.cs View File

@@ -59,7 +59,7 @@ namespace Discord.WebSocket
ThreadCreationInterval = model.SlowMode.Value;

Tags = model.ForumTags.GetValueOrDefault(Array.Empty<API.ForumTags>()).Select(
x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault())
x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault(), x.Moderated)
).ToImmutableArray();
}



Loading…
Cancel
Save