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

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

View File

@@ -16,7 +16,9 @@ namespace Discord.WebSocket
private readonly MessageCache _messages;
public string Topic { get; private set; }
internal bool Nsfw { get; private set; }
private bool _nsfw;
public bool IsNsfw => _nsfw || ChannelHelper.IsNsfw(this);
public string Mention => MentionUtils.MentionChannel(Id);
public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>();
@@ -42,7 +44,7 @@ namespace Discord.WebSocket
base.Update(state, model);
Topic = model.Topic.Value;
Nsfw = model.Nsfw.GetValueOrDefault();
_nsfw = model.Nsfw.GetValueOrDefault();
}
public Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)
@@ -146,8 +148,5 @@ namespace Discord.WebSocket
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
=> EnterTypingState(options);
// IChannel
bool IChannel.IsNsfw => Nsfw || ChannelHelper.IsNsfw(this);
}
}