mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-05 01:19:35 +00:00
25 lines
736 B
C#
25 lines
736 B
C#
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using CliFx;
|
|
using CliFx.Attributes;
|
|
using DiscordChatExporter.Cli.Commands.Base;
|
|
using DiscordChatExporter.Core.Utils.Extensions;
|
|
|
|
namespace DiscordChatExporter.Cli.Commands
|
|
{
|
|
[Command("guilds", Description = "Get the list of accessible guilds.")]
|
|
public class GetGuildsCommand : TokenCommandBase
|
|
{
|
|
public override async ValueTask ExecuteAsync(IConsole console)
|
|
{
|
|
var guilds = await Discord.GetUserGuildsAsync();
|
|
|
|
foreach (var guild in guilds.OrderBy(g => g.Name))
|
|
{
|
|
await console.Output.WriteLineAsync(
|
|
$"{guild.Id} | {guild.Name}"
|
|
);
|
|
}
|
|
}
|
|
}
|
|
} |