buildVotePoll static method

Command buildVotePoll({
  1. required int pollId,
  2. required List<int> pollOptionIds,
  3. required String channelUrl,
  4. required ChannelType channelType,
  5. String? requestId,
})

Only supports group channel

Implementation

static Command buildVotePoll({
  required int pollId,
  required List<int> pollOptionIds,
  required String channelUrl,
  required ChannelType channelType,
  String? requestId,
}) {
  if (channelType == ChannelType.open) {
    throw SBError(message: "Vote Message only supports group channel");
  }

  final payload = <String, dynamic>{
    'channel_url': channelUrl,
    'channel_type':
        channelType.commandString, // Currently only supports group channel
    'poll_id': pollId,
    'option_ids': pollOptionIds,
  };

  return Command(
    cmd: CommandString.pollVote,
    payload: payload,
    requestId: requestId,
  );
}