EDA.API.Poll (EDA v0.3.0)

Copy Markdown View Source

REST API endpoints for Discord message polls.

All functions return {:ok, result} or {:error, reason}.

Summary

Functions

Expires a poll before its scheduled end time.

Gets users who voted for a specific poll answer.

Functions

expire(channel_id, message_id)

@spec expire(String.t() | integer(), String.t() | integer()) ::
  {:ok, map()} | {:error, term()}

Expires a poll before its scheduled end time.

Returns the updated message containing the expired poll.

Parameters

  • channel_id - The channel containing the poll message
  • message_id - The message containing the poll

Examples

EDA.API.Poll.expire("123456", "789012")

get_voters(channel_id, message_id, answer_id, opts \\ [])

@spec get_voters(String.t() | integer(), String.t() | integer(), integer(), keyword()) ::
  {:ok, [map()]} | {:error, term()}

Gets users who voted for a specific poll answer.

Parameters

  • channel_id - The channel containing the poll message
  • message_id - The message containing the poll
  • answer_id - The answer ID to get voters for

Options

  • :after - Snowflake ID for pagination (get users after this ID)
  • :limit - Number of users to return (1-100, default: 25)

Examples

EDA.API.Poll.get_voters("123456", "789012", 1)
EDA.API.Poll.get_voters("123456", "789012", 1, after: "111222", limit: 50)