diff options
Diffstat (limited to 'lib/command/command.ex')
| -rw-r--r-- | lib/command/command.ex | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/lib/command/command.ex b/lib/command/command.ex deleted file mode 100644 index 07be96c..0000000 --- a/lib/command/command.ex +++ /dev/null @@ -1,57 +0,0 @@ -alias Phoenix.PubSub -alias Nostrum.Api - -defmodule Thulani.Command do - use GenServer - use Thulani.Command.Util - require Logger - - def start_link(arg) do - GenServer.start_link(__MODULE__, arg) - end - - @impl true - def init(_) do - PubSub.subscribe(:thulani_pubsub, "cmd") - {:ok, %{}} - end - - @impl true - def handle_info(Util.command("meme", "", _msg), state) do - {:noreply, state} - end - - @impl true - def handle_info(Util.command("meme", rest, _msg), state) do - case rest do - "" -> Thulani.Meme - end - - {:noreply, state} - end - - def handle_info(Util.command("http", _rest, _msg), _state) do - end - - def handle_info(Util.command("roll", rest, msg), state) do - Logger.info("hi") - - case rest do - " " <> expr -> - case Thulani.Calc.eval(expr) do - {:ok, val} -> Api.create_message!(msg.channel_id, "#{val}") - {:error, err} -> Logger.error("BAD: #{err}") - end - - _ -> - Logger.error("nothing else in the message") - end - - {:noreply, state} - end - - def handle_info(_msg, state) do - Logger.debug("unhandled message") - {:noreply, state} - end -end |
