[skip ci] feat: prepare for public release

This commit is contained in:
Hampus Kraft
2026-01-02 19:27:51 +00:00
parent 197b23757f
commit 5ae825fc7d
199 changed files with 38391 additions and 33358 deletions

View File

@@ -644,11 +644,33 @@ request_voice_token(GuildId, ChannelId, UserId, VoicePermissions) ->
endpoint => maps:get(<<"endpoint">>, Data),
connection_id => maps:get(<<"connectionId">>, Data)
}};
{error, {http_error, _Status, Body}} ->
case parse_unclaimed_error(Body) of
true ->
{error, voice_unclaimed_account};
false ->
logger:error("[guild_voice_connection] RPC request failed: ~p", [{http_error, Body}]),
{error, voice_token_failed}
end;
{error, Reason} ->
logger:error("[guild_voice_connection] RPC request failed: ~p", [Reason]),
{error, Reason}
{error, voice_token_failed}
end.
parse_unclaimed_error(Body) when is_binary(Body) ->
try jsx:decode(Body, [return_maps]) of
#{<<"code">> := <<"UNCLAIMED_ACCOUNT_RESTRICTED">>} ->
true;
#{<<"error">> := #{<<"code">> := <<"UNCLAIMED_ACCOUNT_RESTRICTED">>}} ->
true;
_ ->
false
catch
_:_ -> false
end;
parse_unclaimed_error(_) ->
false.
-spec pending_voice_connections(guild_state()) -> pending_voice_connections().
pending_voice_connections(State) ->
case maps:get(pending_voice_connections, State, undefined) of