volume static method

Future<String> volume(
  1. CommandContext ctx
)

Implementation

static Future<String> volume(CommandContext ctx) async {
  if (ctx.args.isEmpty) {
    final player = ctx.client.getPlayer(ctx.guildId);
    if (player == null) {
      return '❌ No player active!';
    }

    return '🔊 Current volume: ${player.volume}%';
  }

  final volume = int.tryParse(ctx.args[0]);
  if (volume == null || volume < 0 || volume > 1000) {
    return '❌ Volume must be between 0 and 1000!';
  }

  await ctx.client.setVolume(ctx.guildId, volume);
  return '🔊 Volume set to $volume%';
}