VoiceChannel.fromPayload constructor

VoiceChannel.fromPayload(
  1. dynamic payload
)

Implementation

factory VoiceChannel.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 VoiceChannel(
    payload['bitrate'],
    payload['user_limit'],
    payload['rtc_region'],
    payload['video_quality_mode'] ?? VideoQualityMode.auto.value,
    payload['nsfw'] ?? false,
    WebhookManager(payload['guild_id'], payload['id']),
    MessageManager(payload['guild_id'], payload['id']),
    payload['last_message_id'],
    payload['guild_id'],
    payload['parent_id'],
    payload['name'],
    payload['type'],
    payload['position'],
    payload['flags'],
    permissionOverwriteManager,
    payload['id']
  );
}