mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-05 17:39:33 +00:00
30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using System.Threading.Tasks;
|
|
using CliFx;
|
|
using CliFx.Attributes;
|
|
using DiscordChatExporter.Core.Models;
|
|
using DiscordChatExporter.Core.Services;
|
|
|
|
namespace DiscordChatExporter.Cli.Commands
|
|
{
|
|
public abstract class TokenCommandBase : ICommand
|
|
{
|
|
protected DataService DataService { get; }
|
|
|
|
[CommandOption("token", 't', IsRequired = true, EnvironmentVariableName = "DISCORD_TOKEN",
|
|
Description = "Authorization token.")]
|
|
public string TokenValue { get; set; } = "";
|
|
|
|
[CommandOption("bot", 'b', EnvironmentVariableName = "DISCORD_TOKEN_BOT",
|
|
Description = "Whether this authorization token belongs to a bot.")]
|
|
public bool IsBotToken { get; set; }
|
|
|
|
protected AuthToken Token => new AuthToken(IsBotToken ? AuthTokenType.Bot : AuthTokenType.User, TokenValue);
|
|
|
|
protected TokenCommandBase(DataService dataService)
|
|
{
|
|
DataService = dataService;
|
|
}
|
|
|
|
public abstract ValueTask ExecuteAsync(IConsole console);
|
|
}
|
|
} |