fromMap static method

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

Implementation

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