fetchPruneCount method

Future<int> fetchPruneCount(
  1. Snowflake id,
  2. {int? days,
  3. List<Snowflake>? roleIds}
)

Fetch the prune count in a guild.

Implementation

Future<int> fetchPruneCount(Snowflake id, {int? days, List<Snowflake>? roleIds}) async {
  final route = HttpRoute()
    ..guilds(id: id.toString())
    ..prune();
  final request = BasicRequest(route, queryParameters: {
    if (days != null) 'days': days.toString(),
    if (roleIds != null) 'include_roles': roleIds.map((e) => e.toString()).join(','),
  });

  final response = await client.httpHandler.executeSafe(request);
  return (response.jsonBody as Map<String, Object?>)['pruned'] as int;
}