Alchemy.Voice.listen_for_end
You're seeing just the function
listen_for_end
, go back to Alchemy.Voice module for more information.
Link to this function
listen_for_end(guild)
Specs
Lets this process listen for the end of an audio track in a guild.
This will subscribe this process up until the next time an audio track ends, to react to this, you'll want to handle the message in some way, e.g.
Voice.listen_for_end(guild)
receive do
{:audio_stopped, ^guild} -> IO.puts "audio has stopped"
end
This is mainly designed for use in genservers, or other places where you don't
want to block. If you do want to block and wait immediately, try
wait_for_end/2
instead.
Examples
Use in a genserver:
def handle_info({:audio_stopped, guild}, state) do
IO.puts "audio has stopped in #{guild}"
Voice.listen_for_end(guild)
{:noreply, state}
end