MessageProperties<T extends Channel>.fromJson constructor
MessageProperties<T extends Channel>.fromJson(
- Map<String, dynamic> json
)
Implementation
factory MessageProperties.fromJson(Map<String, dynamic> json) {
final embedSerializer = ioc.resolve<MarshallerContract>().serializers.embed;
final embeds = List.from(json['embeds'])
.map((element) => embedSerializer.serialize(element) as MessageEmbed)
.toList();
return MessageProperties(
id: Snowflake.parse(json['id']),
content: json['content'],
channelId: Snowflake.parse(json['channel_id']),
authorId: Snowflake.nullable(json['author_id']),
serverId: Snowflake.nullable(json['server_id']),
authorIsBot: json['author_is_bot'] ?? false,
embeds: embeds,
createdAt: DateTime.parse(json['timestamp']),
updatedAt: Helper.createOrNull(
field: json['edited_timestamp'],
fn: () => DateTime.parse(json['edited_timestamp'])),
);
}