GuildScheduledEvent.from constructor
GuildScheduledEvent.from({
- required ChannelManager channelManager,
- required MemberManager memberManager,
- required dynamic payload,
Implementation
factory GuildScheduledEvent.from({ required ChannelManager channelManager, required MemberManager memberManager, required payload }) {
return GuildScheduledEvent(
id: payload['id'],
//guild: guild,
channel: payload['channel_id'] != null ? channelManager.cache.get(payload['channel_id']) : null,
creator: payload['creator_id'] != null ? memberManager.cache.get(payload['creator_id']) : null,
name: payload['name'],
description: payload['description'],
startTime: DateTime.parse(payload['scheduled_start_time']),
endTime: payload['scheduled_end_time'] != null ? DateTime.parse(payload['scheduled_end_time']) : null,
status: ScheduledEventStatus.values.firstWhere((element) => element.value == payload['status']),
entityType: ScheduledEventEntityType.values.firstWhere((element) => element.value == payload['entity_type']),
entityId: payload['entity_id'],
image: payload['image'],
location: payload['entity_metadata'] != null && payload['entity_metadata']['location'] != null ? payload['entity_metadata']['location'] : null
);
}