delete method

Future<Channel> delete(
  1. Snowflake id,
  2. {String? auditLogReason}
)

Delete a guild channel or close a DM channel.

Implementation

Future<Channel> delete(Snowflake id, {String? auditLogReason}) async {
  final route = HttpRoute()..channels(id: id.toString());
  final request = BasicRequest(
    route,
    method: 'DELETE',
    auditLogReason: auditLogReason,
  );

  final response = await client.httpHandler.executeSafe(request);
  final channel = parse(response.jsonBody as Map<String, Object?>);

  cache.remove(channel.id);
  return channel;
}