fromMap static method

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

Implementation

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