|
|
@ -22,7 +22,9 @@ public class ChannelExporter(DiscordClient discord)
|
|
|
|
if (request.Channel.Kind == ChannelKind.GuildForum)
|
|
|
|
if (request.Channel.Kind == ChannelKind.GuildForum)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) is a forum and cannot be exported directly. "
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) "
|
|
|
|
|
|
|
|
+ $"of guild '{request.Guild.Name}' (#{request.Guild.Id}) "
|
|
|
|
|
|
|
|
+ $"is a forum and cannot be exported directly. "
|
|
|
|
+ "You need to pull its threads and export them individually."
|
|
|
|
+ "You need to pull its threads and export them individually."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -31,7 +33,9 @@ public class ChannelExporter(DiscordClient discord)
|
|
|
|
if (request.Channel.IsEmpty)
|
|
|
|
if (request.Channel.IsEmpty)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) does not contain any messages."
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) "
|
|
|
|
|
|
|
|
+ $"of guild '{request.Guild.Name}' (#{request.Guild.Id}) "
|
|
|
|
|
|
|
|
+ $"does not contain any messages."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +43,9 @@ public class ChannelExporter(DiscordClient discord)
|
|
|
|
if (request.After is not null && !request.Channel.MayHaveMessagesAfter(request.After.Value))
|
|
|
|
if (request.After is not null && !request.Channel.MayHaveMessagesAfter(request.After.Value))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) does not contain any messages within the specified period."
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) "
|
|
|
|
|
|
|
|
+ $"of guild '{request.Guild.Name}' (#{request.Guild.Id}) "
|
|
|
|
|
|
|
|
+ $"does not contain any messages within the specified period."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -50,7 +56,9 @@ public class ChannelExporter(DiscordClient discord)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) does not contain any messages within the specified period."
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) "
|
|
|
|
|
|
|
|
+ $"of guild '{request.Guild.Name}' (#{request.Guild.Id}) "
|
|
|
|
|
|
|
|
+ $"does not contain any messages within the specified period."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -84,7 +92,9 @@ public class ChannelExporter(DiscordClient discord)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Provide more context to the exception, to simplify debugging based on error messages
|
|
|
|
// Provide more context to the exception, to simplify debugging based on error messages
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
$"Failed to export message #{message.Id} in channel '{request.Channel.Name}' (#{request.Channel.Id}).",
|
|
|
|
$"Failed to export message #{message.Id} "
|
|
|
|
|
|
|
|
+ $"in channel '{request.Channel.Name}' (#{request.Channel.Id}) "
|
|
|
|
|
|
|
|
+ $"of guild '{request.Guild.Name} (#{request.Guild.Id})'.",
|
|
|
|
ex is not DiscordChatExporterException dex || dex.IsFatal,
|
|
|
|
ex is not DiscordChatExporterException dex || dex.IsFatal,
|
|
|
|
ex
|
|
|
|
ex
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -95,7 +105,9 @@ public class ChannelExporter(DiscordClient discord)
|
|
|
|
if (messageExporter.MessagesExported <= 0)
|
|
|
|
if (messageExporter.MessagesExported <= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
throw new DiscordChatExporterException(
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) does not contain any matching messages within the specified period."
|
|
|
|
$"Channel '{request.Channel.Name}' (#{request.Channel.Id}) "
|
|
|
|
|
|
|
|
+ $"of guild '{request.Guild.Name}' (#{request.Guild.Id}) "
|
|
|
|
|
|
|
|
+ $"does not contain any matching messages within the specified period."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|