Removed IChannel#Nsfw, added to ITextChannel

This commit is contained in:
Christopher F
2017-08-29 17:26:36 -04:00
parent 5d7f2fc7ec
commit 608bc359ee
10 changed files with 14 additions and 17 deletions

View File

@@ -46,7 +46,6 @@ namespace Discord.Rest
//IChannel
string IChannel.Name => null;
bool IChannel.IsNsfw => false;
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult<IUser>(null); //Overriden

View File

@@ -15,7 +15,8 @@ namespace Discord.Rest
public string Mention => MentionUtils.MentionChannel(Id);
internal bool Nsfw { get; private set; }
private bool _nsfw;
public bool IsNsfw => _nsfw || ChannelHelper.IsNsfw(this);
internal RestTextChannel(BaseDiscordClient discord, IGuild guild, ulong id)
: base(discord, guild, id)
@@ -32,7 +33,7 @@ namespace Discord.Rest
base.Update(model);
Topic = model.Topic.Value;
Nsfw = model.Nsfw.GetValueOrDefault();
_nsfw = model.Nsfw.GetValueOrDefault();
}
public async Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)
@@ -152,6 +153,5 @@ namespace Discord.Rest
else
return AsyncEnumerable.Empty<IReadOnlyCollection<IGuildUser>>();
}
bool IChannel.IsNsfw => Nsfw || ChannelHelper.IsNsfw(this);
}
}

View File

@@ -99,7 +99,6 @@ namespace Discord.Rest
//IChannel
string IChannel.Name { get { throw new NotSupportedException(); } }
bool IChannel.IsNsfw { get { throw new NotSupportedException(); } }
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
{
throw new NotSupportedException();