fromMap static method

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

Implementation

static Future<PrivateSelectContext> fromMap(
    MarshallerContract marshaller,
    DataStoreContract datastore,
    EntityContext ctx,
    Map<String, dynamic> payload) async {
  return PrivateSelectContext(
    ctx: ctx,
    customId: (payload['data'] as Map<String, dynamic>)['custom_id'] as String,
    id: Snowflake.parse(payload['id']),
    applicationId: Snowflake.parse(payload['application_id']),
    token: payload['token'] as String,
    version: payload['version'] as int,
    userId: Snowflake.parse((payload['user'] as Map<String, dynamic>)['id']),
    messageId: Snowflake.nullable((payload['message'] as Map<String, dynamic>)['id'] as String?),
    channelId: Snowflake.nullable(payload['channel_id'] as String?),
  );
}