|
|
@@ -14,16 +14,6 @@ namespace Discord.Rest |
|
|
|
public static async Task<Model> CreateThreadAsync(BaseDiscordClient client, ITextChannel channel, string name, ThreadType type = ThreadType.PublicThread, |
|
|
|
ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null) |
|
|
|
{ |
|
|
|
var features = channel.Guild.Features; |
|
|
|
if (autoArchiveDuration == ThreadArchiveDuration.OneWeek && !features.HasFeature(GuildFeature.SevenDayThreadArchive)) |
|
|
|
throw new ArgumentException($"The guild {channel.Guild.Name} does not have the SEVEN_DAY_THREAD_ARCHIVE feature!", nameof(autoArchiveDuration)); |
|
|
|
|
|
|
|
if (autoArchiveDuration == ThreadArchiveDuration.ThreeDays && !features.HasFeature(GuildFeature.ThreeDayThreadArchive)) |
|
|
|
throw new ArgumentException($"The guild {channel.Guild.Name} does not have the THREE_DAY_THREAD_ARCHIVE feature!", nameof(autoArchiveDuration)); |
|
|
|
|
|
|
|
if (type == ThreadType.PrivateThread && !features.HasFeature(GuildFeature.PrivateThreads)) |
|
|
|
throw new ArgumentException($"The guild {channel.Guild.Name} does not have the PRIVATE_THREADS feature!", nameof(type)); |
|
|
|
|
|
|
|
if (channel is INewsChannel && type != ThreadType.NewsThread) |
|
|
|
throw new ArgumentException($"{nameof(type)} must be a {ThreadType.NewsThread} in News channels"); |
|
|
|
|
|
|
|