From 8dd1283b628e8af064940c32c7d3fc7e8953fc53 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 6 Jun 2023 17:01:17 -0400 Subject: [PATCH] chore: Upgrade to Nostrum 0.7.0 --- lib/sergei/consumer.ex | 6 +----- lib/sergei/player.ex | 5 ++++- lib/sergei/voice_cache.ex | 6 +----- mix.exs | 2 +- mix.lock | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/sergei/consumer.ex b/lib/sergei/consumer.ex index 2df0ade..d4cec7d 100644 --- a/lib/sergei/consumer.ex +++ b/lib/sergei/consumer.ex @@ -22,10 +22,6 @@ defmodule Sergei.Consumer do {"song", "What song is currently playing?", []} ] - def start_link do - Consumer.start_link(__MODULE__) - end - # Initialization of the Discord Client def handle_event({:READY, %{guilds: guilds} = _event, _ws_state}) do # Playing some tunes @@ -101,7 +97,7 @@ defmodule Sergei.Consumer do # /play def do_command(%{ guild_id: guild_id, - member: %{user: %{id: invoker_id}}, + user: %{id: invoker_id}, data: %{name: "play", options: [%{name: "url", value: url}]} }) do case Sergei.VoiceStateCache.get_state(invoker_id) do diff --git a/lib/sergei/player.ex b/lib/sergei/player.ex index 6deb06f..9fc3c86 100644 --- a/lib/sergei/player.ex +++ b/lib/sergei/player.ex @@ -84,7 +84,10 @@ defmodule Sergei.Player do channel_id end) |> Enum.map(fn channel_id -> Map.get(channel_to_guild, channel_id) end) - |> Enum.each(fn guild_id -> stop(guild_id) end) + |> Enum.each(fn guild_id -> + Voice.stop(guild_id) + Voice.leave_channel(guild_id) + end) Process.send_after(self(), :check_empty, @check_empty_interval) {:noreply, state} diff --git a/lib/sergei/voice_cache.ex b/lib/sergei/voice_cache.ex index f9477ae..82ba772 100644 --- a/lib/sergei/voice_cache.ex +++ b/lib/sergei/voice_cache.ex @@ -32,11 +32,7 @@ defmodule Sergei.VoiceStateCache do %{ guild_id: guild_id, channel_id: channel_id, - member: %{ - user: %{ - id: user_id - } - } + user_id: user_id } = state entry = %{ diff --git a/mix.exs b/mix.exs index df8b22d..c202c6d 100644 --- a/mix.exs +++ b/mix.exs @@ -32,7 +32,7 @@ defmodule Sergei.MixProject do # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"} {:plug_cowboy, "~> 2.0"}, {:cowlib, "~> 2.11", hex: :remedy_cowlib, override: true}, - {:nostrum, github: "Kraigie/nostrum"} + {:nostrum, "~> 0.7.0"} ] end end diff --git a/mix.lock b/mix.lock index 5e4b949..38d7fef 100644 --- a/mix.lock +++ b/mix.lock @@ -12,7 +12,7 @@ "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, "kcl": {:hex, :kcl, "1.4.2", "8b73a55a14899dc172fcb05a13a754ac171c8165c14f65043382d567922f44ab", [:mix], [{:curve25519, ">= 1.0.4", [hex: :curve25519, repo: "hexpm", optional: false]}, {:ed25519, "~> 1.3", [hex: :ed25519, repo: "hexpm", optional: false]}, {:poly1305, "~> 1.0", [hex: :poly1305, repo: "hexpm", optional: false]}, {:salsa20, "~> 1.0", [hex: :salsa20, repo: "hexpm", optional: false]}], "hexpm", "9f083dd3844d902df6834b258564a82b21a15eb9f6acdc98e8df0c10feeabf05"}, "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, - "nostrum": {:git, "https://github.com/Kraigie/nostrum.git", "802f6b1aeee1533b548f9c923522bafe9a29bfdd", []}, + "nostrum": {:hex, :nostrum, "0.7.0", "3d5212928a9996dca46d5f9d29077abbb02f4f5c14b86b89fb7e506ea5812310", [:mix], [{:certifi, "~> 2.8", [hex: :certifi, repo: "hexpm", optional: false]}, {:gun, "~> 2.0", [hex: :gun, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:kcl, "~> 1.4", [hex: :kcl, repo: "hexpm", optional: false]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm", "e6ba475d06974c90ac9912d781f36803cdacf9fa5f7451f633dbad77312441d8"}, "plug": {:hex, :plug, "1.14.2", "cff7d4ec45b4ae176a227acd94a7ab536d9b37b942c8e8fa6dfc0fff98ff4d80", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "842fc50187e13cf4ac3b253d47d9474ed6c296a8732752835ce4a86acdf68d13"}, "plug_cowboy": {:hex, :plug_cowboy, "2.6.1", "9a3bbfceeb65eff5f39dab529e5cd79137ac36e913c02067dba3963a26efe9b2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "de36e1a21f451a18b790f37765db198075c25875c64834bcc82d90b309eb6613"}, "plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"},