Compare commits

...

7 Commits

Author SHA1 Message Date
Tyrrrz 80b59d1254 Update version 2023-10-19 18:52:19 +03:00
Tyrrrz 6579563816 Don't unfurl URLs in notify job 2023-10-17 16:18:44 +03:00
Tyrrrz e2971ed3a6 Improve notify job message 2023-10-17 15:01:59 +03:00
Tyrrrz a0a263f074 Improve error message for forum channels
Related to #1144
2023-10-16 17:22:28 +03:00
Tyrrrz 1438fd9f77 Temp fix for the docs link in the readme 2023-10-16 17:12:40 +03:00
Tyrrrz b298b45cf7 Escape markup in CLI 2023-10-13 01:17:13 +03:00
Tyrrrz 8d01c6be35 Improve notify message format 2023-10-12 16:00:47 +03:00
9 changed files with 38 additions and 12 deletions
+1 -1
View File
@@ -148,6 +148,6 @@ jobs:
body: | body: |
{ {
"avatar_url": "https://raw.githubusercontent.com/${{ github.event.repository.full_name }}/${{ github.ref_name }}/favicon.png", "avatar_url": "https://raw.githubusercontent.com/${{ github.event.repository.full_name }}/${{ github.ref_name }}/favicon.png",
"content": "**${{ github.event.repository.name }}** new version released!\nVersion: `${{ github.ref_name }}`\nDownload: <${{ github.event.repository.html_url }}/releases/tag/${{ github.ref_name }}>\nChangelog: <${{ github.event.repository.html_url }}/blob/${{ github.ref_name }}/Changelog.md>" "content": "**${{ github.event.repository.name }}** v${{ github.ref_name }} has been released!\n🔗 [Download](<${{ github.event.repository.html_url }}/releases/tag/${{ github.ref_name }}>) • [Changelog](<${{ github.event.repository.html_url }}/blob/${{ github.ref_name }}/Changelog.md>)"
} }
retry-count: 5 retry-count: 5
+7
View File
@@ -1,5 +1,12 @@
# Changelog # Changelog
## v2.42.1 (19-Oct-2023)
- General changes:
- Improved the error message shown when trying to export a forum channel. Such channels cannot be exported directly, you need to fetch and export their individual threads instead.
- CLI changes:
- Fixed an issue where fetching threads with `[` or `]` in their name crashed the application.
## v2.42 (12-Oct-2023) ## v2.42 (12-Oct-2023)
- General changes: - General changes:
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Version>2.42</Version> <Version>2.42.1</Version>
<Company>Tyrrrz</Company> <Company>Tyrrrz</Company>
<Copyright>Copyright (c) Oleksii Holub</Copyright> <Copyright>Copyright (c) Oleksii Holub</Copyright>
<LangVersion>preview</LangVersion> <LangVersion>preview</LangVersion>
@@ -200,7 +200,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
try try
{ {
await ctx.StartTaskAsync( await ctx.StartTaskAsync(
channel.GetHierarchicalName(), Markup.Escape(channel.GetHierarchicalName()),
async progress => async progress =>
{ {
var guild = await Discord.GetGuildAsync( var guild = await Discord.GetGuildAsync(
@@ -80,7 +80,10 @@ public class ExportAllCommand : ExportCommandBase
channels.Add(channel); channels.Add(channel);
ctx.Status($"Fetched '{channel.GetHierarchicalName()}'."); ctx.Status(
Markup.Escape($"Fetched '{channel.GetHierarchicalName()}'.")
);
fetchedChannelsCount++; fetchedChannelsCount++;
} }
} }
@@ -114,7 +117,10 @@ public class ExportAllCommand : ExportCommandBase
{ {
channels.Add(thread); channels.Add(thread);
ctx.Status($"Fetched '{thread.GetHierarchicalName()}'."); ctx.Status(
Markup.Escape($"Fetched '{thread.GetHierarchicalName()}'.")
);
fetchedThreadsCount++; fetchedThreadsCount++;
} }
} }
@@ -142,7 +148,11 @@ public class ExportAllCommand : ExportCommandBase
{ {
foreach (var dumpChannel in dump.Channels) foreach (var dumpChannel in dump.Channels)
{ {
ctx.Status($"Fetching '{dumpChannel.Name}' ({dumpChannel.Id})..."); ctx.Status(
Markup.Escape(
$"Fetching '{dumpChannel.Name}' ({dumpChannel.Id})..."
)
);
try try
{ {
@@ -58,7 +58,8 @@ public class ExportGuildCommand : ExportCommandBase
channels.Add(channel); channels.Add(channel);
ctx.Status($"Fetched '{channel.GetHierarchicalName()}'."); ctx.Status(Markup.Escape($"Fetched '{channel.GetHierarchicalName()}'."));
fetchedChannelsCount++; fetchedChannelsCount++;
} }
} }
@@ -90,7 +91,8 @@ public class ExportGuildCommand : ExportCommandBase
{ {
channels.Add(thread); channels.Add(thread);
ctx.Status($"Fetched '{thread.GetHierarchicalName()}'."); ctx.Status(Markup.Escape($"Fetched '{thread.GetHierarchicalName()}'."));
fetchedThreadsCount++; fetchedThreadsCount++;
} }
} }
@@ -44,8 +44,7 @@ internal static class ConsoleExtensions
var actualDescription = !string.IsNullOrWhiteSpace(description) ? description : "..."; var actualDescription = !string.IsNullOrWhiteSpace(description) ? description : "...";
var progressTask = context.AddTask( var progressTask = context.AddTask(
// Don't recognize random square brackets as style tags actualDescription,
Markup.Escape(actualDescription),
new ProgressTaskSettings { MaxValue = 1 } new ProgressTaskSettings { MaxValue = 1 }
); );
@@ -22,11 +22,18 @@ public class ChannelExporter
{ {
// Forum channels don't have messages, they are just a list of threads // Forum channels don't have messages, they are just a list of threads
if (request.Channel.Kind == ChannelKind.GuildForum) if (request.Channel.Kind == ChannelKind.GuildForum)
throw new DiscordChatExporterException("Channel is a forum."); {
throw new DiscordChatExporterException(
"Channel is a forum and cannot be exported directly. "
+ "You need to pull its threads and export them individually."
);
}
// Check if the channel is empty // Check if the channel is empty
if (request.Channel.IsEmpty) if (request.Channel.IsEmpty)
{
throw new DiscordChatExporterException("Channel does not contain any messages."); throw new DiscordChatExporterException("Channel does not contain any messages.");
}
// Check if the 'after' boundary is valid // Check if the 'after' boundary is valid
if (request.After is not null && !request.Channel.MayHaveMessagesAfter(request.After.Value)) if (request.After is not null && !request.Channel.MayHaveMessagesAfter(request.After.Value))
+2 -1
View File
@@ -23,7 +23,8 @@
**DiscordChatExporter** is an application that can be used to export message history from any [Discord](https://discord.com) channel to a file. **DiscordChatExporter** is an application that can be used to export message history from any [Discord](https://discord.com) channel to a file.
It works with direct messages, group messages, and server channels, and supports Discord's dialect of markdown as well as most other rich media features. It works with direct messages, group messages, and server channels, and supports Discord's dialect of markdown as well as most other rich media features.
> ❔ If you have questions or issues, **please refer to the [docs](.docs)**. <!-- Can't use a relative link here due to a bug in markdown parsing -->
> ❔ If you have questions or issues, **please refer to the [docs](https://github.com/Tyrrrz/DiscordChatExporter/tree/master/.docs)**.
> 💬 If you want to chat, **join my [Discord server](https://discord.gg/2SUWKFnHSm)**. > 💬 If you want to chat, **join my [Discord server](https://discord.gg/2SUWKFnHSm)**.