serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Derive application ID from bot token

Open kangalio opened this issue 3 years ago • 3 comments

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.

kangalio avatar Jul 31 '21 13:07 kangalio

Unfortunately, it is not true for old bots. But indeed if it is possible, defaulting to the bot id might be a good option

HarmoGlace avatar Jul 31 '21 13:07 HarmoGlace

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.

vicky5124 avatar Jul 31 '21 13:07 vicky5124

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..

Milo123459 avatar Sep 28 '21 17:09 Milo123459

The application ID is now retrieved from gateway which is more robust and just as convenient for the user

kangalio avatar Sep 08 '22 08:09 kangalio