Add IChannel.Nsfw, RequireNsfw precondition (#633)
* Add IChannel.Nsfw, RequireNsfw precondition * Refactored IChannel.Nsfw to IsNsfw, removed NsfwUtils Per pull-request feedback * proper nsfw channel check
This commit is contained in:
committed by
RogueException
parent
05f8f41567
commit
7f1fc286cf
@@ -289,5 +289,10 @@ namespace Discord.Rest
|
||||
author = RestUser.Create(client, guild, model, webhookId);
|
||||
return author;
|
||||
}
|
||||
|
||||
public static bool IsNsfw(IChannel channel) =>
|
||||
IsNsfw(channel.Name);
|
||||
public static bool IsNsfw(string channelName) =>
|
||||
channelName == "nsfw" || channelName.StartsWith("nsfw-");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Discord.Rest
|
||||
|
||||
//IChannel
|
||||
string IChannel.Name => null;
|
||||
bool IChannel.IsNsfw => ChannelHelper.IsNsfw(this);
|
||||
|
||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IUser>(null); //Overriden
|
||||
|
||||
@@ -97,6 +97,7 @@ 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();
|
||||
|
||||
Reference in New Issue
Block a user