REST API endpoints for Discord message reactions.
All functions return :ok or {:ok, result} or {:error, reason}.
The emoji parameter accepts a string ("👍" or "name:id") or an EDA.Emoji struct.
Summary
Functions
Adds a reaction to a message.
Removes all reactions from a message.
Removes all reactions of a specific emoji from a message.
Removes own reaction from a message.
Removes a user's reaction from a message.
Gets users who reacted with an emoji.
Returns a lazy Stream that paginates through all users who reacted with an emoji.
Functions
@spec create( String.t() | integer(), String.t() | integer(), String.t() | EDA.Emoji.t() ) :: :ok | {:error, term()}
Adds a reaction to a message.
Removes all reactions from a message.
@spec delete_emoji( String.t() | integer(), String.t() | integer(), String.t() | EDA.Emoji.t() ) :: :ok | {:error, term()}
Removes all reactions of a specific emoji from a message.
@spec delete_own( String.t() | integer(), String.t() | integer(), String.t() | EDA.Emoji.t() ) :: :ok | {:error, term()}
Removes own reaction from a message.
@spec delete_user( String.t() | integer(), String.t() | integer(), String.t() | EDA.Emoji.t(), String.t() | integer() ) :: :ok | {:error, term()}
Removes a user's reaction from a message.
@spec list( String.t() | integer(), String.t() | integer(), String.t() | EDA.Emoji.t(), keyword() ) :: {:ok, [map()]} | {:error, term()}
Gets users who reacted with an emoji.
@spec stream( String.t() | integer(), String.t() | integer(), String.t() | EDA.Emoji.t(), keyword() ) :: Enumerable.t()
Returns a lazy Stream that paginates through all users who reacted with an emoji.
Uses after-only pagination (Discord constraint for the reactions endpoint).
Options
:per_page— users per request (1-100, default 100):after— start after this user ID
Examples
EDA.API.Reaction.stream(channel_id, message_id, "👍") |> Enum.to_list()
EDA.API.Reaction.stream(channel_id, message_id, "👍", per_page: 50)
|> Stream.take(10) |> Enum.to_list()