Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListApplicationEmojis's response body does not get deserialised into a list of Emojis #2373

Open
fdnt7 opened this issue Sep 15, 2024 · 0 comments

Comments

@fdnt7
Copy link

fdnt7 commented Sep 15, 2024

Summary

twilight_http as of revision 561bebb's ListApplicationEmojis does not get deserialised correctly upon awaiting and calling .model()/.models() on it, and it raises DeserializeBodyError { kind: Deserializing, source: Some(Error("invalid type: map, expected a sequence", line: 1, column: 0)) }.

Steps to reproduce

  1. Copy the minimal bot setup as stated in the twilight-gateway example here. Pin twilight-http, twilight-gateway and twilight-model to revision 561bebb.
  2. Apply the following diff:
31a32,35
>     let app = client.current_user_application().await?.model().await?;
>     let emojis = client.get_application_emojis(app.id).await?.models().await?;
>     tracing::info!(?emojis);
> 
  1. Prepare a bot account.
  2. Run the bot via running DISCORD_TOKEN="..." cargo run, replacing ... with the bot's token.

Expected Behaviour

The application emojis should be logged in the console.

Actual Behaviour

The bot process shortly exits after running with the following error:

Error: failed to deserialize response body

Caused by:
    invalid type: map, expected a sequence at line 1 column 0

Additional Information

The Discord API Documentation states that GET /applications/{application.id}/emojis returns an object containing a list of emoji objects for the given application under the items key, not a list itself (In contrast to GET /guilds/{guild.id}/emojis/{emoji.id}). This may be the cause of the issue, as both ListApplicationEmojis and GetEmojis has the output of type Result<Response<ListBody<Emoji>>, Error>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant