Tyrrrz / DiscordChatExporter

Exports Discord chat logs to a file
MIT License
7.29k stars 668 forks source link

Rework the CLI commands to be more composable #1210

Open Tyrrrz opened 4 months ago

Tyrrrz commented 4 months ago

Currently, we have commands like exportguild, exportall, exportdm which allow the user to export batches of channels. There are some filtering options available in those commands (such as --include-vc, --include-threads, etc), but they are not very composable.

If the user wants to have full control over which channels they want to export, the recommended approach is to use the channels command to fetch all channels (with some filtering available too), and then manually plug the IDs into the export command.

We can streamline this flow by making the channels command more configurable in terms of filters and, most importantly, making its output pipe-able into export. The idea is that the export command will not have any filtering options whatsoever (and exportguild, exportall, exportdm will be completely removed), but instead the user can pipe the result of channels directly.

For example:

$ dotnet DiscordChatExporter.dll channels --guild 123456 --token 123456 --include-threads --include-dm | dotnet DiscordChatExporter.dll export --token 123456

(to avoid repeating the --token twice, you can set it as an environment variable)

The channels command can detect if its output is being redirected and change the format to only produce channel IDs, separated by newlines. If the output is not redirected, then the current, info-rich and user-friendly format is used. We can also add command options to control this behavior explicitly.

CanePlayz commented 4 months ago

Sounds great