Browse Source

Revert thread block for news channel. Add check for news channel

Co-Authored-By: Nova Fox <novamaday@gmail.com>
pull/1958/head
quin lynch 3 years ago
parent
commit
c9e38792ff
3 changed files with 3 additions and 15 deletions
  1. +0
    -8
      src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs
  2. +3
    -0
      src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs
  3. +0
    -7
      src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs

+ 0
- 8
src/Discord.Net.Rest/Entities/Channels/RestNewsChannel.cs View File

@@ -25,13 +25,5 @@ namespace Discord.Rest
return entity;
}
public override int SlowModeInterval => throw new NotSupportedException("News channels do not support Slow Mode.");

/// <summary>
/// <b>News channels do not support thread creation with bots.</b>
/// </summary>
/// <inheritdoc/>
/// <exception cref="NotSupportedException"></exception>
public override Task<RestThreadChannel> CreateThreadAsync(string name, ThreadType type = ThreadType.PublicThread, ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null)
=> throw new NotSupportedException("Cannot create threads in News channels");
}
}

+ 3
- 0
src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs View File

@@ -21,6 +21,9 @@ namespace Discord.Rest
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");

var args = new StartThreadParams
{
Name = name,


+ 0
- 7
src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs View File

@@ -36,12 +36,5 @@ namespace Discord.WebSocket
public override int SlowModeInterval
=> throw new NotSupportedException("News channels do not support Slow Mode.");

/// <summary>
/// <b>News channels do not support thread creation with bots.</b>
/// </summary>
/// <inheritdoc/>
/// <exception cref="NotSupportedException"></exception>
public override Task<SocketThreadChannel> CreateThreadAsync(string name, ThreadType type = ThreadType.PublicThread, ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null)
=> throw new NotSupportedException("Cannot create threads in News channels");
}
}

Loading…
Cancel
Save