Skip to content

Conversation

@KubaZ2
Copy link
Member

@KubaZ2 KubaZ2 commented Nov 6, 2025

No description provided.

@KubaZ2 KubaZ2 requested a review from Copilot November 6, 2025 22:09
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

The documentation preview is available at https://preview.netcord.dev/209.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors event invocation methods in the Gateway client to improve memory efficiency by avoiding unnecessary lambda closures. The changes convert captured lambdas to static lambdas with explicit parameter passing.

  • Refactored InvokeEventAsync overloads to accept raw data parameters and static lambda functions
  • Changed JsonReadyEventArgs.Application property from nullable to non-nullable
  • Removed redundant ApplicationFlags property from GatewayClient (now accessible via ReadyEventArgs)
  • Updated all event invocations throughout GatewayClient and VoiceClient to use the new pattern

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
NetCord/Gateway/WebSocketClient.cs Added new InvokeEventAsync overloads with raw data parameters and updated UpdateLatencyAsync to use new pattern; contains bugs in the 5-parameter overload (missing static modifier and incorrect method call)
NetCord/Gateway/Voice/VoiceClient.cs Updated event invocations to use static lambdas with explicit parameter passing
NetCord/Gateway/JsonModels/EventArgs/JsonReadyEventArgs.cs Changed Application property from nullable to non-nullable
NetCord/Gateway/GatewayClient.cs Removed ApplicationFlags property, removed unused import, converted GetGuildId to static local function, and updated all event invocations to new pattern
NetCord/Gateway/EventArgs/ReadyEventArgs.cs Removed null checks for Application property access

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@KubaZ2 KubaZ2 requested a review from Copilot November 6, 2025 22:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@KubaZ2 KubaZ2 requested a review from Copilot November 7, 2025 01:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Reordered generic constraints in `InvokeEventAsync` method
signatures to ensure consistent ordering. Updated the
`where TClient : WebSocketClient` constraint to appear
before `where T : allows ref struct` and `where TRaw :
allows ref struct`. These changes improve code readability
and adhere to coding standards.
Refactored `InvokeEventAsync` and `InvokeEventWithDisposalAsync` calls in `GatewayClient` and `VoiceClient` classes to improve readability and maintainability:
- Standardized parameter naming (`data` instead of `rawData`) across event handlers.
- Simplified `CHANNEL_DELETE`, `THREAD_DELETE`, `GUILD_DELETE`, `GUILD_SCHEDULED_EVENT_DELETE`, and `STAGE_INSTANCE_DELETE` handlers in `GatewayClient` by using consistent variable names and tuple structures.
- Updated `VoiceClient` to align parameter naming and improve clarity in `VoiceReceiveEventArgs` construction.

These changes enhance code consistency and reduce complexity, making the codebase easier to maintain.
@KubaZ2 KubaZ2 requested a review from Copilot November 7, 2025 12:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@KubaZ2 KubaZ2 merged commit 2d32737 into alpha Nov 7, 2025
7 checks passed
@KubaZ2 KubaZ2 deleted the refactor/event-invocation branch November 7, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants