|
|
@ -1,8 +1,7 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using DiscordChatExporter.Cli.Verbs.Options;
|
|
|
|
using DiscordChatExporter.Cli.Verbs.Options;
|
|
|
|
using DiscordChatExporter.Core.Models;
|
|
|
|
using DiscordChatExporter.Core.Helpers;
|
|
|
|
using DiscordChatExporter.Core.Services;
|
|
|
|
using DiscordChatExporter.Core.Services;
|
|
|
|
using Tyrrrz.Extensions;
|
|
|
|
using Tyrrrz.Extensions;
|
|
|
|
|
|
|
|
|
|
|
@ -32,12 +31,16 @@ namespace DiscordChatExporter.Cli.Verbs
|
|
|
|
var chatLog = await dataService.GetChatLogAsync(Options.GetToken(), Options.ChannelId,
|
|
|
|
var chatLog = await dataService.GetChatLogAsync(Options.GetToken(), Options.ChannelId,
|
|
|
|
Options.After, Options.Before);
|
|
|
|
Options.After, Options.Before);
|
|
|
|
|
|
|
|
|
|
|
|
// Generate file path if not set
|
|
|
|
// Generate file path if not set or is a directory
|
|
|
|
var filePath = Options.FilePath;
|
|
|
|
var filePath = Options.FilePath;
|
|
|
|
if (filePath == null || filePath.EndsWith("/") || filePath.EndsWith("\\"))
|
|
|
|
if (filePath == null || filePath.EndsWith("/") || filePath.EndsWith("\\"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
filePath += $"{chatLog.Guild.Name} - {chatLog.Channel.Name}.{Options.ExportFormat.GetFileExtension()}"
|
|
|
|
// Generate default file name
|
|
|
|
.Replace(Path.GetInvalidFileNameChars(), '_');
|
|
|
|
var defaultFileName = ExportHelper.GetDefaultExportFileName(Options.ExportFormat, chatLog.Guild,
|
|
|
|
|
|
|
|
chatLog.Channel, Options.After, Options.Before);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Append the file name to the file path
|
|
|
|
|
|
|
|
filePath += defaultFileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Export
|
|
|
|
// Export
|
|
|
|