execute method

  1. @override
Future<String> execute(
  1. CommandContext context
)
override

Implementation

@override
Future<String> execute(CommandContext context) async {
  if (context.args.length < 2) {
    return '❌ Usage: !move <from> <to>';
  }

  final from = int.tryParse(context.args[0]);
  final to = int.tryParse(context.args[1]);

  if (from == null || to == null) {
    return '❌ Invalid positions!';
  }

  final player = context.player;
  player.moveInQueue(from - 1, to - 1);

  return '✅ Moved track from position $from to $to';
}