mirror of
https://codeberg.org/godmaire/sergei.git
synced 2024-09-19 15:58:26 +00:00
Replace control with filtering
This commit is contained in:
parent
b8e7c0f87b
commit
a8551a2ba7
1 changed files with 4 additions and 4 deletions
|
@ -24,10 +24,10 @@ defmodule Sergei.Player do
|
|||
@impl true
|
||||
def handle_info(:tick, state) do
|
||||
state
|
||||
|> Enum.each(fn {guild_id, %{url: url, paused: paused}} = _state ->
|
||||
if not Voice.playing?(guild_id) and not paused do
|
||||
Voice.play(guild_id, url, :ytdl)
|
||||
end
|
||||
|> Enum.filter(fn {_id, %{paused: paused} = _state} -> not paused end)
|
||||
|> Enum.filter(fn {guild_id, _data} -> not Voice.playing?(guild_id) end)
|
||||
|> Enum.each(fn {guild_id, %{url: url}} = _state ->
|
||||
Voice.play(guild_id, url, :ytdl)
|
||||
end)
|
||||
|
||||
Process.send_after(self(), :tick, 100)
|
||||
|
|
Loading…
Reference in a new issue