Skip to content

Commit

Permalink
fix: correct create_message/2 clause
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceEEC committed Jul 18, 2018
1 parent bfe72b1 commit 8caa4b2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/rest.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ defmodule Crux.Rest do
def create_message(%Message{channel_id: channel_id}, args), do: create_message(channel_id, args)
def create_message(%Channel{id: channel_id}, args), do: create_message(channel_id, args)

def create_message(channel_id, not_map) when not is_map(not_map),
do: create_message(channel_id, Map.new(not_map))

def create_message(channel_id, %{files: files} = args) when is_number(channel_id) do
Enum.reduce_while(files, [], fn file, acc ->
with {:error, error} <- Util.map_file(file) do
Expand Down Expand Up @@ -136,8 +133,7 @@ defmodule Crux.Rest do
end
end

def create_message(channel_id, args),
do: real_create_message(channel_id, Map.new(not_map))
def create_message(channel_id, args), do: real_create_message(channel_id, Map.new(args))

defp real_create_message(channel_id, args, disposition \\ []) do
Rest.Base.queue(:post, Endpoints.channel_messages(channel_id), args, disposition)
Expand Down

0 comments on commit 8caa4b2

Please sign in to comment.