fromMap static method

Future<ServerSelectContext> fromMap(
  1. DataStoreContract datastore,
  2. Map<String, dynamic> payload
)

Implementation

static Future<ServerSelectContext> fromMap(
    DataStoreContract datastore, Map<String, dynamic> payload) async {
  return ServerSelectContext(
    customId: payload['data']['custom_id'],
    id: Snowflake(payload['id']),
    applicationId: Snowflake(payload['application_id']),
    token: payload['token'],
    version: payload['version'],
    message: await datastore.message.getServerMessage(
      messageId: Snowflake(payload['message']['id']),
      channelId: Snowflake(payload['channel_id']),
    ),
    member: await datastore.member.getMember(
      serverId: Snowflake(payload['guild_id']),
      memberId: Snowflake(payload['member']['user']['id']),
    ),
  );
}