fromMap static method

Future<PrivateSelectContext> fromMap(
  1. MarshallerContract marshaller,
  2. DataStoreContract datastore,
  3. Map<String, dynamic> payload
)

Implementation

static Future<PrivateSelectContext> fromMap(MarshallerContract marshaller,
    DataStoreContract datastore, Map<String, dynamic> payload) async {
  return PrivateSelectContext(
    customId: payload['data']['custom_id'],
    id: Snowflake(payload['id']),
    applicationId: Snowflake(payload['application_id']),
    token: payload['token'],
    version: payload['version'],
    message: await datastore.message.getPrivateMessage(
      messageId: Snowflake(payload['message']['id']),
      channelId: Snowflake(payload['channel_id']),
    ),
    user: await marshaller.serializers.user.serialize(payload['user']),
  );
}