TextChannel.fromPayload constructor

TextChannel.fromPayload(
  1. dynamic payload
)

Implementation

factory TextChannel.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 TextChannel(
    payload['topic'],
    payload['last_pin_timestamp'],
    payload['rate_limit_per_user'],
    ThreadManager(payload['guild_id']),
    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']
  );
}