Mark ChannelHelper.IsNsfw Obsolete
Discord no longer treats channels prefixed with 'nsfw' as NSFW, so we no longer need to have this check.
This commit is contained in:
@@ -338,8 +338,10 @@ namespace Discord.Rest
|
|||||||
return author;
|
return author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use channel.IsNsfw instead")]
|
||||||
public static bool IsNsfw(IChannel channel)
|
public static bool IsNsfw(IChannel channel)
|
||||||
=> IsNsfw(channel.Name);
|
=> IsNsfw(channel.Name);
|
||||||
|
[Obsolete("Use Channel.IsNsfw instead")]
|
||||||
public static bool IsNsfw(string channelName) =>
|
public static bool IsNsfw(string channelName) =>
|
||||||
channelName == "nsfw" || channelName.StartsWith("nsfw-");
|
channelName == "nsfw" || channelName.StartsWith("nsfw-");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Discord.Rest
|
|||||||
public string Mention => MentionUtils.MentionChannel(Id);
|
public string Mention => MentionUtils.MentionChannel(Id);
|
||||||
|
|
||||||
private bool _nsfw;
|
private bool _nsfw;
|
||||||
public bool IsNsfw => _nsfw || ChannelHelper.IsNsfw(this);
|
public bool IsNsfw => _nsfw;
|
||||||
|
|
||||||
internal RestTextChannel(BaseDiscordClient discord, IGuild guild, ulong id)
|
internal RestTextChannel(BaseDiscordClient discord, IGuild guild, ulong id)
|
||||||
: base(discord, guild, id)
|
: base(discord, guild, id)
|
||||||
@@ -47,7 +47,7 @@ namespace Discord.Rest
|
|||||||
=> ChannelHelper.GetUserAsync(this, Guild, Discord, id, options);
|
=> ChannelHelper.GetUserAsync(this, Guild, Discord, id, options);
|
||||||
public IAsyncEnumerable<IReadOnlyCollection<RestGuildUser>> GetUsersAsync(RequestOptions options = null)
|
public IAsyncEnumerable<IReadOnlyCollection<RestGuildUser>> GetUsersAsync(RequestOptions options = null)
|
||||||
=> ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options);
|
=> ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options);
|
||||||
|
|
||||||
public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null)
|
public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null)
|
||||||
=> ChannelHelper.GetMessageAsync(this, Discord, id, options);
|
=> ChannelHelper.GetMessageAsync(this, Discord, id, options);
|
||||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
|
||||||
@@ -89,7 +89,7 @@ namespace Discord.Rest
|
|||||||
=> ChannelHelper.GetWebhookAsync(this, Discord, id, options);
|
=> ChannelHelper.GetWebhookAsync(this, Discord, id, options);
|
||||||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
|
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
|
||||||
=> ChannelHelper.GetWebhooksAsync(this, Discord, options);
|
=> ChannelHelper.GetWebhooksAsync(this, Discord, options);
|
||||||
|
|
||||||
public Task<ICategoryChannel> GetCategoryAsync(RequestOptions options = null)
|
public Task<ICategoryChannel> GetCategoryAsync(RequestOptions options = null)
|
||||||
=> ChannelHelper.GetCategoryAsync(this, Discord, options);
|
=> ChannelHelper.GetCategoryAsync(this, Discord, options);
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ namespace Discord.Rest
|
|||||||
else
|
else
|
||||||
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>();
|
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
|
||||||
{
|
{
|
||||||
if (mode == CacheMode.AllowDownload)
|
if (mode == CacheMode.AllowDownload)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Discord.WebSocket
|
|||||||
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null;
|
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null;
|
||||||
|
|
||||||
private bool _nsfw;
|
private bool _nsfw;
|
||||||
public bool IsNsfw => _nsfw || ChannelHelper.IsNsfw(this);
|
public bool IsNsfw => _nsfw;
|
||||||
|
|
||||||
public string Mention => MentionUtils.MentionChannel(Id);
|
public string Mention => MentionUtils.MentionChannel(Id);
|
||||||
public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>();
|
public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>();
|
||||||
|
|||||||
Reference in New Issue
Block a user