serenity-rs / serenity

A Rust library for the Discord API.
https://discord.gg/serenity-rs
ISC License
4.65k stars 571 forks source link

Error in CurrentApplicationInfo causing crash in certain case #2883

Closed ValgulNecron closed 3 weeks ago

ValgulNecron commented 2 months ago

In current branch if we try to access application info with ctx.http.get_current_application_info().await.unwrap(); we get the error

thread 'tokio-runtime-worker' panicked at src\main.rs:162:65: called "Result::unwrap()" on an "Err" value: Json(Error("missing field "oauth2_install_params"", line: 1, column: 706)) stack backtrace:

this is due by the fact that bot are not required to have "installation link" (option are none, Discord provided link and custom url). if we check the CurrentApplicationInfothere is a integration_types_configwhich take an InstallationContextConfig and inside it there is oauth2_install_params: InstallParams wich should be from my understanding of discord docs be an option since there is the ? next to the field name.