Retrieve Poll Voters (Effect) — DiSky

Addon: DiSky · Category: Effect · Since: 4.29.0

Syntax

retrieve [(all|every)] [poll] voters of [poll] answer %number% (of|in|from) %message% [(with|using) [the] [bot] %-bot%] and store (them|the voters) in %~objects%

Description

Retrieve all users who voted for a specific answer of a poll message. The answer can be specified by its 1-indexed position (a number) or by passing a poll answer object directly. Returns a list of users — the bot must have read access to the channel containing the poll.

Examples

# Important: pass the Message, not the MessagePoll.
# The JDA API exposes retrievePollVoters on Message, not on the poll itself.

retrieve message with id "..." from channel with id "..." and store it in {_msg}
set {_poll} to poll of {_msg}

# By position
retrieve poll voters of answer 1 of {_msg} and store them in {_voters::*}

# By answer object — note we still pass {_msg}, not {_poll}
loop poll answers of {_poll}:
    retrieve poll voters of loop-value of {_msg} and store them in {_voters::*}
    broadcast "Answer '%answer text of loop-value%': %size of {_voters::*}% voters"

View source