-
-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Add missing properties in forum & thread channels (#2469)
* add `AppliedTags` property * convert collections into immutable arrays * remove "not supported" remark * implement `ThreadChannelProperties` * Add `DefaultSlowModeInterval` and `DefaultSlowModeInterval` properties to forum channels * add `Moderated` property to `ForumTag`` * `ForumTag` inherits `ISnowflakeEntity` * Fix `DiscordRestClient.GetChannelAsync` not getting forum channel * a lot of changes added: - channel flags - `ForumTagBuilder` - imroved channel modification * fixed a bug in forum tag emoji parsing * inherit forum channel from `INesteeChannel` * implement `INestedChannel` in forum channels * Add `Flags` property to channels * add iteraface for forum tags & add equality operators * Add default reaction emoji property * add support for modifing default reaction & some renaming * add createForumChannelAsync to guild * *fix resharper being a d... and moving code to next line* * add a `ForumChannels` property * Some fixes & add support for `default_sort_order` * fix misleading comment * fix #2502 * support creating post with applied tags * fix xmldoc * set category id on model update * add limit checks for tag count
- Loading branch information
Showing
45 changed files
with
1,132 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Discord; | ||
|
||
/// <summary> | ||
/// Represents public flags for a channel. | ||
/// </summary> | ||
public enum ChannelFlags | ||
{ | ||
/// <summary> | ||
/// Default value for flags, when none are given to a channel. | ||
/// </summary> | ||
None = 0, | ||
|
||
/// <summary> | ||
/// Flag given to a thread channel pinned on top of parent forum channel. | ||
/// </summary> | ||
Pinned = 1 << 1, | ||
|
||
/// <summary> | ||
/// Flag given to a forum channel that requires people to select tags when posting. | ||
/// </summary> | ||
RequireTag = 1 << 4 | ||
} |
60 changes: 60 additions & 0 deletions
60
src/Discord.Net.Core/Entities/Channels/ForumChannelProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Discord; | ||
|
||
public class ForumChannelProperties : TextChannelProperties | ||
{ | ||
|
||
/// <summary> | ||
/// Gets or sets the topic of the channel. | ||
/// </summary> | ||
/// <remarks> | ||
/// Not available in forum channels. | ||
/// </remarks> | ||
public new Optional<int> SlowModeInterval { get; } | ||
|
||
/// <summary> | ||
/// Gets or sets rate limit on creating posts in this forum channel. | ||
/// </summary> | ||
/// <remarks> | ||
/// Setting this value to anything above zero will require each user to wait X seconds before | ||
/// creating another thread; setting this value to <c>0</c> will disable rate limits for this channel. | ||
/// <note> | ||
/// Users with <see cref="Discord.ChannelPermission.ManageMessages"/> or | ||
/// <see cref="ChannelPermission.ManageChannels"/> will be exempt from rate limits. | ||
/// </note> | ||
/// </remarks> | ||
/// <exception cref="ArgumentOutOfRangeException">Thrown if the value does not fall within [0, 21600].</exception> | ||
public Optional<int> ThreadCreationInterval { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Gets or sets the default slow-mode for threads in this channel. | ||
/// </summary> | ||
/// <remarks> | ||
/// Setting this value to anything above zero will require each user to wait X seconds before | ||
/// sending another message; setting this value to <c>0</c> will disable slow-mode for child threads. | ||
/// <note> | ||
/// Users with <see cref="Discord.ChannelPermission.ManageMessages"/> or | ||
/// <see cref="ChannelPermission.ManageChannels"/> will be exempt from slow-mode. | ||
/// </note> | ||
/// </remarks> | ||
/// <exception cref="ArgumentOutOfRangeException">Thrown if the value does not fall within [0, 21600].</exception> | ||
public Optional<int> DefaultSlowModeInterval { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a collection of tags inside of this forum channel. | ||
/// </summary> | ||
public Optional<IEnumerable<ForumTagProperties>> Tags { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a new default reaction emoji in this forum channel. | ||
/// </summary> | ||
public Optional<IEmote> DefaultReactionEmoji { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the rule used to order posts in forum channels. | ||
/// </summary> | ||
public Optional<ForumSortOrder> DefaultSortOrder { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Discord; | ||
|
||
/// <summary> | ||
/// Defines the rule used to order posts in forum channels. | ||
/// </summary> | ||
public enum ForumSortOrder | ||
{ | ||
/// <summary> | ||
/// Sort forum posts by activity. | ||
/// </summary> | ||
LatestActivity = 0, | ||
|
||
/// <summary> | ||
/// Sort forum posts by creation time (from most recent to oldest). | ||
/// </summary> | ||
CreationDate = 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Discord.Net.Core/Entities/Channels/ThreadChannelProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Discord; | ||
|
||
|
||
/// <summary> | ||
/// Provides properties that are used to modify an <see cref="IThreadChannel"/> with the specified changes. | ||
/// </summary> | ||
/// <seealso cref="IThreadChannel.ModifyAsync(System.Action{ThreadChannelProperties}, RequestOptions)"/> | ||
public class ThreadChannelProperties : TextChannelProperties | ||
{ | ||
/// <summary> | ||
/// Gets or sets the tags applied to a forum thread | ||
/// </summary> | ||
public Optional<IEnumerable<ulong>> AppliedTags { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets whether or not the thread is locked. | ||
/// </summary> | ||
public Optional<bool> Locked { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets whether or not the thread is archived. | ||
/// </summary> | ||
public Optional<bool> Archived { get; set; } | ||
} |
Oops, something went wrong.