The app crashes when trying to use Alchmey.Client.create_channel/3. The channel is created though, but I can't take the results from the function. The reason is that Discord's response is status code 201, and there is no pattern match for this.
Error message:
iex(6)> result = Alchemy.Client.create_channel(id, "test")
** (FunctionClauseError) no function clause matching in Alchemy.Discord.RateLimits.rate_info/1
The following arguments were given to Alchemy.Discord.RateLimits.rate_info/1:
# 1
%HTTPoison.Response{
body: "{\"id\": \"_hidden\", \"last_message_id\": null, \"type\": 0, \"name\": \"test\", \"position\": 26, \"parent_id\": \"_hidden\", \"guild_id\": \"_hidden\"}",
headers: _hidden,
request: %HTTPoison.Request{
body: _body,
headers: [
{"X-RateLimit-Precision", "millisecond"},
{"Content-Type", "application/json"},
{"Authorization",
"Bot _hidden_"},
{"User-Agent",
"DiscordBot (https://github.com/cronokirby/alchemy, 0.6.0)"}
],
method: :post,
options: [],
params: %{},
url: "https://discord.com/api/v6/guilds/_hidden/channels"
},
request_url: "https://discord.com/api/v6/guilds/_hidden/channels",
status_code: 201
}
Attempted function clauses (showing 3 out of 3):
def rate_info(%{status_code: 204})
def rate_info(%{status_code: 200, headers: h})
def rate_info(%{status_code: 429, headers: h, body: body})
(alchemy 0.6.5) lib/Discord/rate_limits.ex:24: Alchemy.Discord.RateLimits.rate_info/1
(alchemy 0.6.5) lib/Discord/api.ex:127: Alchemy.Discord.Api.handle_response/2
(alchemy 0.6.5) lib/Discord/rate_manager.ex:37: Alchemy.Discord.RateManager.process_req/3
The app crashes when trying to use
Alchmey.Client.create_channel/3
. The channel is created though, but I can't take the results from the function. The reason is that Discord's response is status code 201, and there is no pattern match for this.Error message: