discord-net/Discord.Net

How to consume Rest API scoped?

Frostchi opened this issue · 0 comments

Title. Basically I have a web app that gets OAuth authorization from users, and I get an access token for that user (identity/email).

I didn't realize DiscordRestClient is instantiating http clients each time which leads to socket exhaustion. Not to mention the implications for rate limiting.

Is there a way to do this where my scoped api controller can have concurrent access to the rest api across different users?

Otherwise I'd need a singleton, and would have to call Login -> read data -> Logout, before proceeding to the next request which doesn't seem very good, but I'm not seeing an obvious solution here besides rolling my own minimal wrapper.