serenity
serenity copied to clipboard
Derive application ID from bot token
Currently, the bot's application ID must be provided manually if unstable_discord_api features are used.
However, the bot token contains the bot ID, which can be extracted via serenity::utils::parse_token. I think the bot ID is equal to the application ID, so it may be possible to remove the requirement of supplying the application ID manually.
Unfortunately, it is not true for old bots. But indeed if it is possible, defaulting to the bot id might be a good option
Not in all applications the bot id matches the application ID, this is the case on old applications. application_id() should still exist as a manual override, just in case.
So this'd essentially work like: When you call .start on the Client, extract the application ID and use that? But if it's an old bot where application_id != client_id you'd have to use a manual override..
The application ID is now retrieved from gateway which is more robust and just as convenient for the user