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
feat: add support for using
keyword on discord.js Client
and WebSocketManager
#10063
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #10063 +/- ##
==========================================
- Coverage 58.36% 58.35% -0.01%
==========================================
Files 242 243 +1
Lines 17184 17206 +22
Branches 1243 1243
==========================================
+ Hits 10029 10041 +12
- Misses 7110 7120 +10
Partials 45 45
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe look into doing this in WS as well? WebSocketManager
specifically
using
keyword on Client
using
keyword on discord.js Client
and WebSocketManager
…eat/using-support
Please describe the changes this PR makes and why it should be merged:
This adds support for explicit resource management for the
Client
instances in discord.js, as well as theWebSocketManager
inws
. This is done by polyfillingSymbol.dispose
andSymbol.asyncDispose
(if not already provided by the runtime).Users who support the correct TypeScript project configuration can use the following syntax to clean up resources after the client goes out of scope or if it errors out:
Or if you're using the
WebSocketManager
from@discordjs/ws
directly:Closes #10057
Status and versioning classification: