ButtonInteraction.fromPayload constructor

ButtonInteraction.fromPayload(
  1. PartialChannel channel,
  2. dynamic payload
)

Implementation

factory ButtonInteraction.fromPayload(PartialChannel channel, dynamic payload) {
  return ButtonInteraction(
    payload['id'],
    null,
    payload['application_id'],
    payload['version'],
    payload['type'],
    payload['token'],
    payload['member']?['user']?['id'] ?? payload['user']?['id'],
    payload['guild_id'],
    (payload['guild_id'] != null ? Message.from(channel: channel as GuildChannel, payload: payload['message']) : DmMessage.from(channel: channel as DmChannel, payload: payload['message'])) as PartialMessage<PartialChannel>?,
    payload['data']['custom_id'],
    payload['channel_id'],
  );
}