fromJson static method
Implementation
static Message fromJson(Map<String, dynamic> json) {
return Message(
id: json['id'],
channelId: json['channel_id'],
guildId: json['guild_id'],
author: User.fromJson(json['author']),
member: ifNotNull(Member.fromJson, json['member']),
content: json['content'],
timestamp: json['timestamp'],
editedTimestamp: json['edited_timestamp'],
tts: json['tts'],
mentionEveryone: json['mention_everyone'],
mentions: fromArray(User.fromJson, json['mentions'])!,
mentionRoles: fromArray(Role.fromJson, json['mention_roles'])!,
mentionChannels: fromArray(
ChannelMention.fromJson,
json['mention_channels'],
),
attachments: fromArray(Attachment.fromJson, json['attachments'])!,
embeds: fromArray(Embed.fromJson, json['embeds'])!,
reactions: fromArray(Reaction.fromJson, json['reactions']),
nonce: json['nonce'],
pinned: json['pinned'],
webhookId: json['webhook_id'],
type: json['type'],
activity: ifNotNull(MessageActivity.fromJson, json['activity']),
application: ifNotNull(MessageApplication.fromJson, json['application']),
messageReference: ifNotNull(
MessageReference.fromJson,
json['message_reference'],
),
flags: json['flags'],
stickers: fromArray(Sticker.fromJson, json['stickers']),
referencedMessage:
ifNotNull(Message.fromJson, json['referenced_message']),
interaction: ifNotNull(MessageInteraction.fromJson, json['interaction']),
);
}