Add CLI command to export all available channels in a guild (#123)

This commit is contained in:
TVdata 2018-12-19 16:53:21 +02:00 committed by Alexey Golub
parent 17b0161ade
commit bf5cedb646
6 changed files with 135 additions and 29 deletions

View file

@ -226,12 +226,9 @@ namespace DiscordChatExporter.Core.Services
return new ChatLog(guild, channel, from, to, messages, mentionables);
}
public async Task<ChatLog> GetChatLogAsync(AuthToken token, string channelId,
public async Task<ChatLog> GetChatLogAsync(AuthToken token, Channel channel,
DateTime? from = null, DateTime? to = null, IProgress<double> progress = null)
{
// Get channel
var channel = await GetChannelAsync(token, channelId);
// Get guild
var guild = channel.GuildId == Guild.DirectMessages.Id
? Guild.DirectMessages
@ -241,6 +238,16 @@ namespace DiscordChatExporter.Core.Services
return await GetChatLogAsync(token, guild, channel, from, to, progress);
}
public async Task<ChatLog> GetChatLogAsync(AuthToken token, string channelId,
DateTime? from = null, DateTime? to = null, IProgress<double> progress = null)
{
// Get channel
var channel = await GetChannelAsync(token, channelId);
// Get the chat log
return await GetChatLogAsync(token, channel, from, to, progress);
}
public void Dispose()
{
_httpClient.Dispose();