Adapt DeleteMessagesCommand to upstream CliFx + PowerKit changes

Upstream replaced CliFx.Attributes with CliFx.Binding and now
requires command classes to be partial. Pipe() was also moved
from DiscordChatExporter.Core.Utils.Extensions to PowerKit.Extensions.
This commit is contained in:
primetime43 2026-05-17 11:11:39 -04:00
parent c38953d868
commit 5ad979f69c

View file

@ -1,35 +1,35 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using CliFx.Attributes; using CliFx.Binding;
using CliFx.Infrastructure; using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base; using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord; using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Utils.Extensions; using PowerKit.Extensions;
namespace DiscordChatExporter.Cli.Commands; namespace DiscordChatExporter.Cli.Commands;
[Command("deletemessages", Description = "Deletes messages from a channel.")] [Command("deletemessages", Description = "Deletes messages from a channel.")]
public class DeleteMessagesCommand : DiscordCommandBase public partial class DeleteMessagesCommand : DiscordCommandBase
{ {
[CommandOption( [CommandOption(
"channel", "channel",
'c', 'c',
Description = "Channel ID. Note: You can only delete your own messages in DMs." Description = "Channel ID. Note: You can only delete your own messages in DMs."
)] )]
public required Snowflake ChannelId { get; init; } public required Snowflake ChannelId { get; set; }
[CommandOption( [CommandOption(
"before", "before",
Description = "Limit to messages sent before this date (formatted using the current culture)." Description = "Limit to messages sent before this date (formatted using the current culture)."
)] )]
public DateTimeOffset? Before { get; init; } public DateTimeOffset? Before { get; set; }
[CommandOption( [CommandOption(
"after", "after",
Description = "Limit to messages sent after this date (formatted using the current culture)." Description = "Limit to messages sent after this date (formatted using the current culture)."
)] )]
public DateTimeOffset? After { get; init; } public DateTimeOffset? After { get; set; }
public override async ValueTask ExecuteAsync(IConsole console) public override async ValueTask ExecuteAsync(IConsole console)
{ {