Waiting for button clicks and reactions inline, instead of in a separate callback.
{:ok, message} = Lingo.Api.Message.create(channel_id, %{content: "Sure?", components: [row]})
case Lingo.Collector.await_component(message.id, timeout: 30_000) do
{:ok, interaction} -> ...
:timeout -> ...
endA component interaction an awaiter takes doesn't reach
Lingo.Bot.handle_component/2. Reactions reach the bot as usual.
Summary
Functions
Waits for a component interaction on a message. Options: :filter (a function that gets the interaction) and :timeout (ms, default 60000). Returns {:ok, interaction} or :timeout.
Waits for a reaction on a message. Takes the same options as await_component/2. Returns {:ok, %Lingo.Event.Reaction{}} or :timeout.
Collects every reaction on a message until :timeout (ms, required) runs out. Takes a :filter too. Returns {:ok, [%Lingo.Event.Reaction{}]}.
Functions
Waits for a component interaction on a message. Options: :filter (a function that gets the interaction) and :timeout (ms, default 60000). Returns {:ok, interaction} or :timeout.
Waits for a reaction on a message. Takes the same options as await_component/2. Returns {:ok, %Lingo.Event.Reaction{}} or :timeout.
Collects every reaction on a message until :timeout (ms, required) runs out. Takes a :filter too. Returns {:ok, [%Lingo.Event.Reaction{}]}.