Remove message content intent check due to false positives

pull/947/head
Tyrrrz 2 years ago
parent 8695942328
commit 2259f19c44

@ -10,7 +10,7 @@ using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data; namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#message-object // https://discord.com/developers/docs/resources/channel#message-object
public partial record Message( public record Message(
Snowflake Id, Snowflake Id,
MessageKind Kind, MessageKind Kind,
User Author, User Author,
@ -26,16 +26,6 @@ public partial record Message(
IReadOnlyList<User> MentionedUsers, IReadOnlyList<User> MentionedUsers,
MessageReference? Reference, MessageReference? Reference,
Message? ReferencedMessage) : IHasId Message? ReferencedMessage) : IHasId
{
public bool IsEmpty =>
Kind == MessageKind.Default &&
string.IsNullOrEmpty(Content) &&
!Attachments.Any() &&
!Embeds.Any() &&
!Stickers.Any();
}
public partial record Message
{ {
private static IReadOnlyList<Embed> NormalizeEmbeds(IReadOnlyList<Embed> embeds) private static IReadOnlyList<Embed> NormalizeEmbeds(IReadOnlyList<Embed> embeds)
{ {

@ -323,11 +323,6 @@ public class DiscordClient
if (message.Timestamp > lastMessage.Timestamp) if (message.Timestamp > lastMessage.Timestamp)
yield break; yield break;
// Make sure the messages are not empty when exporting via a bot
// https://github.com/Tyrrrz/DiscordChatExporter/issues/918
if (_resolvedTokenKind == TokenKind.Bot && message.IsEmpty && !message.Author.IsBot)
throw DiscordChatExporterException.MessageContentIntentMissing();
// Report progress based on the duration of exported messages divided by total // Report progress based on the duration of exported messages divided by total
if (progress is not null) if (progress is not null)
{ {

@ -41,7 +41,4 @@ Failed to perform an HTTP request.
internal static DiscordChatExporterException ChannelIsEmpty() => internal static DiscordChatExporterException ChannelIsEmpty() =>
new("No messages found for the specified period."); new("No messages found for the specified period.");
internal static DiscordChatExporterException MessageContentIntentMissing() =>
new("Failed to retrieve message content because the bot doesn't have the Message Content Intent enabled.");
} }
Loading…
Cancel
Save