Files
DiscordChatExporter/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs
2021-02-22 03:15:22 +02:00

26 lines
855 B
C#

using System.Linq;
using System.Threading.Tasks;
using CliFx;
using CliFx.Attributes;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands
{
[Command("dm", Description = "Get the list of direct message channels.")]
public class GetDirectMessageChannelsCommand : TokenCommandBase
{
public override async ValueTask ExecuteAsync(IConsole console)
{
var channels = await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id);
foreach (var channel in channels.OrderBy(c => c.Name))
{
await console.Output.WriteLineAsync(
$"{channel.Id} | {channel.Category} / {channel.Name}"
);
}
}
}
}