mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 15:53:30 -07:00
33 lines
1,018 B
C#
33 lines
1,018 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using DiscordChatExporter.Cli.Verbs.Options;
|
|
using DiscordChatExporter.Core.Models;
|
|
using DiscordChatExporter.Core.Services;
|
|
|
|
namespace DiscordChatExporter.Cli.Verbs
|
|
{
|
|
public class GetChannelsVerb : Verb<GetChannelsOptions>
|
|
{
|
|
public GetChannelsVerb(GetChannelsOptions options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
public override async Task ExecuteAsync()
|
|
{
|
|
// Get data service
|
|
var dataService = Container.Instance.Get<DataService>();
|
|
|
|
// Get channels
|
|
var channels = await dataService.GetGuildChannelsAsync(Options.GetToken(), Options.GuildId);
|
|
|
|
// Filter and order channels
|
|
channels = channels.Where(c => c.Type == ChannelType.GuildTextChat).OrderBy(c => c.Name).ToArray();
|
|
|
|
// Print result
|
|
foreach (var channel in channels)
|
|
Console.WriteLine($"{channel.Id} | {channel.Name}");
|
|
}
|
|
}
|
|
} |