diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
index 71a477112..c65f3be05 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
@@ -30,7 +30,7 @@ namespace Discord.WebSocket
public int Position { get; private set; }
///
- public IReadOnlyCollection PermissionOverwrites => _overwrites;
+ public virtual IReadOnlyCollection PermissionOverwrites => _overwrites;
///
/// Gets a collection of users that are able to view the channel.
///
@@ -87,7 +87,7 @@ namespace Discord.WebSocket
///
/// An overwrite object for the targeted user; null if none is set.
///
- public OverwritePermissions? GetPermissionOverwrite(IUser user)
+ public virtual OverwritePermissions? GetPermissionOverwrite(IUser user)
{
for (int i = 0; i < _overwrites.Length; i++)
{
@@ -103,7 +103,7 @@ namespace Discord.WebSocket
///
/// An overwrite object for the targeted role; null if none is set.
///
- public OverwritePermissions? GetPermissionOverwrite(IRole role)
+ public virtual OverwritePermissions? GetPermissionOverwrite(IRole role)
{
for (int i = 0; i < _overwrites.Length; i++)
{
@@ -122,7 +122,7 @@ namespace Discord.WebSocket
///
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel.
///
- public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)
+ public virtual async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)
{
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, permissions, options).ConfigureAwait(false);
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue)));
@@ -137,7 +137,7 @@ namespace Discord.WebSocket
///
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel.
///
- public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null)
+ public virtual async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null)
{
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, permissions, options).ConfigureAwait(false);
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue)));
@@ -150,7 +150,7 @@ namespace Discord.WebSocket
///
/// A task representing the asynchronous operation for removing the specified permissions from the channel.
///
- public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)
+ public virtual async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)
{
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false);
@@ -171,7 +171,7 @@ namespace Discord.WebSocket
///
/// A task representing the asynchronous operation for removing the specified permissions from the channel.
///
- public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
+ public virtual async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
{
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false);
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs
index d735c651d..53fea150f 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs
@@ -1,4 +1,7 @@
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
+using System.Threading.Tasks;
using Model = Discord.API.Channel;
namespace Discord.WebSocket
@@ -19,6 +22,31 @@ namespace Discord.WebSocket
entity.Update(state, model);
return entity;
}
- //TODO: Need to set custom channel properties for this type, as apparently it does not support slow mode or overwrites.
+ public override int SlowModeInterval
+ {
+ get { throw new NotSupportedException("News channels do not support Slow Mode."); }
+ }
+ public override Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null)
+ {
+ throw new NotSupportedException("News channels do not support Overwrite Permissions.");
+ }
+ public override Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)
+ {
+ throw new NotSupportedException("News channels do not support Overwrite Permissions.");
+ }
+ public override IReadOnlyCollection PermissionOverwrites
+ => throw new NotSupportedException("News channels do not support Overwrite Permissions.");
+ public override Task SyncPermissionsAsync(RequestOptions options = null)
+ {
+ throw new NotSupportedException("News channels do not support Overwrite Permissions.");
+ }
+ public override Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
+ {
+ throw new NotSupportedException("News channels do not support Overwrite Permissions.");
+ }
+ public override Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)
+ {
+ throw new NotSupportedException("News channels do not support Overwrite Permissions.");
+ }
}
}
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
index 496b96d30..239d39eab 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
@@ -21,7 +21,7 @@ namespace Discord.WebSocket
///
public string Topic { get; private set; }
///
- public int SlowModeInterval { get; private set; }
+ public virtual int SlowModeInterval { get; private set; }
///
public ulong? CategoryId { get; private set; }
///
@@ -33,7 +33,7 @@ namespace Discord.WebSocket
public ICategoryChannel Category
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null;
///
- public Task SyncPermissionsAsync(RequestOptions options = null)
+ public virtual Task SyncPermissionsAsync(RequestOptions options = null)
=> ChannelHelper.SyncPermissionsAsync(this, Discord, options);
private bool _nsfw;