ThreadChannel.fromPayload constructor
ThreadChannel.fromPayload(
- dynamic payload
Implementation
factory ThreadChannel.fromPayload(dynamic payload) {
final permissionOverwriteManager = PermissionOverwriteManager();
if (payload['permission_overwrites'] != null) {
for (final element in payload['permission_overwrites']) {
final PermissionOverwrite overwrite = PermissionOverwrite.from(payload: element);
permissionOverwriteManager.cache.putIfAbsent(overwrite.id, () => overwrite);
}
}
return ThreadChannel(
payload['thread_metadata']['archived'],
payload['thread_metadata']['auto_archive_duration'],
payload['thread_metadata']['locked'],
payload['thread_metadata']['invitable'],
payload['thread_metadata']['create_timestamp'],
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']
);
}