|
|
@ -9,6 +9,39 @@ namespace DiscordChatExporter.Cli
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private static readonly Container Container = new Container();
|
|
|
|
private static readonly Container Container = new Container();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void ShowHelp()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine($"=== Discord Chat Exporter (Command Line Interface) v{version} ===");
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
Console.WriteLine("[-t] [--token] Discord authorization token.");
|
|
|
|
|
|
|
|
Console.WriteLine("[-c] [--channel] Discord channel ID.");
|
|
|
|
|
|
|
|
Console.WriteLine("[-f] [--format] Export format (PlainText/HtmlDark/HtmlLight). Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine("[-o] [--output] Output file path. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--datefrom] Limit to messages after this date. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--dateto] Limit to messages before this date. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--dateformat] Date format. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--grouplimit] Message group limit. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
Console.WriteLine("# To get authorization token:");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Open Discord app");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Log in if you haven't");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Press Ctrl+Shift+I");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Navigate to Application tab");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Expand Storage > Local Storage > https://discordapp.com");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Find \"token\" under key and copy the value");
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
Console.WriteLine("# To get channel ID:");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Open Discord app");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Log in if you haven't");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Go to any channel you want to export");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Press Ctrl+Shift+I");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Navigate to Console tab");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Type \"document.URL\" and press Enter");
|
|
|
|
|
|
|
|
Console.WriteLine(" - Copy the long sequence of numbers after last slash");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static CliOptions ParseOptions(string[] args)
|
|
|
|
private static CliOptions ParseOptions(string[] args)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var argsParser = new FluentCommandLineParser<CliOptions>();
|
|
|
|
var argsParser = new FluentCommandLineParser<CliOptions>();
|
|
|
@ -29,17 +62,7 @@ namespace DiscordChatExporter.Cli
|
|
|
|
// Show help if no arguments
|
|
|
|
// Show help if no arguments
|
|
|
|
if (parsed.EmptyArgs)
|
|
|
|
if (parsed.EmptyArgs)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
|
|
|
ShowHelp();
|
|
|
|
Console.WriteLine($"=== Discord Chat Exporter (Command Line Interface) v{version} ===");
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
Console.WriteLine("[-t] [--token] Discord authorization token.");
|
|
|
|
|
|
|
|
Console.WriteLine("[-c] [--channel] Discord channel ID.");
|
|
|
|
|
|
|
|
Console.WriteLine("[-f] [--format] Export format (PlainText/HtmlDark/HtmlLight). Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine("[-o] [--output] Output file path. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--datefrom] Limit to messages after this date. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--dateto] Limit to messages before this date. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--dateformat] Date format. Optional.");
|
|
|
|
|
|
|
|
Console.WriteLine(" [--grouplimit] Message group limit. Optional.");
|
|
|
|
|
|
|
|
Environment.Exit(0);
|
|
|
|
Environment.Exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Show error if there are any
|
|
|
|
// Show error if there are any
|
|
|
@ -77,6 +100,7 @@ namespace DiscordChatExporter.Cli
|
|
|
|
|
|
|
|
|
|
|
|
// Cleanup container
|
|
|
|
// Cleanup container
|
|
|
|
Container.Cleanup();
|
|
|
|
Container.Cleanup();
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Export complete.");
|
|
|
|
Console.WriteLine("Export complete.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|