CategoryChannel.fromPayload constructor

CategoryChannel.fromPayload(
  1. dynamic payload
)

Implementation

factory CategoryChannel.fromPayload(dynamic payload) {
  final permissionOverwriteManager = PermissionOverwriteManager();
  for (dynamic element in payload['permission_overwrites']) {
    final PermissionOverwrite overwrite = PermissionOverwrite.from(payload: element);
    permissionOverwriteManager.cache.putIfAbsent(overwrite.id, () => overwrite);
  }

  return CategoryChannel(
      payload['guild_id'],
      payload['parent_id'],
      payload['name'],
      payload['type'],
      payload['position'],
      payload['flags'],
      permissionOverwriteManager,
      payload['id']
  );
}