mirror of
https://codeberg.org/godmaire/sergei.git
synced 2024-09-20 00:08:25 +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
|
@impl true
|
||||||
def handle_info(:tick, state) do
|
def handle_info(:tick, state) do
|
||||||
state
|
state
|
||||||
|> Enum.each(fn {guild_id, %{url: url, paused: paused}} = _state ->
|
|> Enum.filter(fn {_id, %{paused: paused} = _state} -> not paused end)
|
||||||
if not Voice.playing?(guild_id) and not paused do
|
|> Enum.filter(fn {guild_id, _data} -> not Voice.playing?(guild_id) end)
|
||||||
Voice.play(guild_id, url, :ytdl)
|
|> Enum.each(fn {guild_id, %{url: url}} = _state ->
|
||||||
end
|
Voice.play(guild_id, url, :ytdl)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Process.send_after(self(), :tick, 100)
|
Process.send_after(self(), :tick, 100)
|
||||||
|
|
Loading…
Reference in a new issue