remove static method

Future<String> remove(
  1. CommandContext ctx
)

Implementation

static Future<String> remove(CommandContext ctx) async {
  if (ctx.args.isEmpty) {
    return '❌ Please provide a track number!';
  }

  final index = int.tryParse(ctx.args[0]);
  if (index == null || index < 1) {
    return '❌ Invalid track number!';
  }

  final manager = ctx.client.getPlayerManager(ctx.guildId);
  if (manager == null) {
    return '❌ No player active!';
  }

  final track = manager.removeFromQueue(index - 1);
  if (track == null) {
    return '❌ Track not found!';
  }

  return '✅ Removed: **${track.info.title}**';
}