Status.from constructor
Status.from({
- required Guild guild,
- required dynamic payload,
Implementation
factory Status.from({ required Guild guild, required dynamic payload }) {
GuildMember guildMember = guild.members.cache.get(payload['user']['id'])!;
List<Activity> activities = [];
for (dynamic element in payload['activities']) {
Activity activity = Activity.from(payload: element);
activities.add(activity);
}
return Status(
guildMember.user,
guild,
StatusType.values.firstWhere((status) => status.toString() == payload['status']),
activities,
payload['client_status'],
);
}