fromMap static method

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

Implementation

static Future<ServerCommandContext> fromMap(MarshallerContract marshaller,
    DataStoreContract datastore, Map<String, dynamic> payload) async {
  return ServerCommandContext(
    id: Snowflake(payload['id']),
    applicationId: Snowflake(payload['application_id']),
    token: payload['token'],
    version: payload['version'],
    member: await datastore.member.getMember(
      serverId: Snowflake(payload['guild_id']),
      memberId: Snowflake(payload['member']['user']['id']),
    ),
    server: await datastore.server.getServer(Snowflake(payload['guild_id'])),
    channel:
        await datastore.channel.getChannel(Snowflake(payload['channel_id'])),
  );
}