Skip to content

Conversation

@AsadHumayun
Copy link
Contributor

This PR will add the VoiceState and VoiceRegion structures.

Mentioning #10981 for visibility.

@vercel
Copy link

vercel bot commented Jan 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Review Updated (UTC)
discord-js Skipped Skipped Jan 27, 2026 11:14pm
discord-js-guide Skipped Skipped Jan 27, 2026 11:14pm

Request Review

@vercel vercel bot temporarily deployed to Preview – discord-js-guide January 25, 2026 01:44 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js January 25, 2026 01:44 Inactive
@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

Introduces two new structure classes—VoiceRegion and VoiceState—representing Discord voice API objects. Both extend the base Structure class with type-safe getters for accessing voice-related properties. The classes are then re-exported through the voice module and main package index.

Changes

Cohort / File(s) Summary
Voice Structure Implementations
packages/structures/src/voice/VoiceRegion.ts, packages/structures/src/voice/VoiceState.ts
New VoiceRegion class with 5 property getters (id, name, optimal, deprecated, custom). New VoiceState class with 12 camelCase property getters mapping to snake_case API fields (guildId, channelId, userId, sessionId, deaf, mute, selfDeaf, selfMute, selfStream, selfVideo, suppress, requestToSpeakTimestamp). Both classes extend Structure, define empty DataTemplate, and expose constructor accepting Partialize data.
Voice Module Exports
packages/structures/src/voice/index.ts
Re-exports VoiceState and VoiceRegion classes.
Main Package Exports
packages/structures/src/index.ts
Adds re-export from ./voice/index.js to expose voice structures in public API.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding voice structure (VoiceState and VoiceRegion classes), which matches the changeset.
Description check ✅ Passed The description directly references the changes by mentioning the addition of VoiceState and VoiceRegion structures, clearly relating to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

❌ Patch coverage is 0% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 31.66%. Comparing base (6538603) to head (fd94e7c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/structures/src/voice/VoiceState.ts 0.00% 27 Missing ⚠️
packages/structures/src/voice/VoiceRegion.ts 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11400      +/-   ##
==========================================
- Coverage   31.75%   31.66%   -0.10%     
==========================================
  Files         381      383       +2     
  Lines       13860    13900      +40     
  Branches     1095     1095              
==========================================
  Hits         4401     4401              
- Misses       9325     9365      +40     
  Partials      134      134              
Flag Coverage Δ
structures 36.12% <0.00%> (-1.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/structures/src/index.ts`:
- Line 15: Move the voice module export so it sits with the other domain module
exports for consistent alphabetical grouping: locate the line "export * from
'./voice/index.js';" in packages/structures/src/index.ts and cut it from after
the core exports (Structure.js, Mixin.js, utils/optimization.js) then paste it
into the block containing domain module exports (automoderation through users)
immediately after the users export so the domain exports remain alphabetically
ordered.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3550b49 and ff50b61.

📒 Files selected for processing (4)
  • packages/structures/src/index.ts
  • packages/structures/src/voice/VoiceRegion.ts
  • packages/structures/src/voice/VoiceState.ts
  • packages/structures/src/voice/index.ts
🧰 Additional context used
🧬 Code graph analysis (2)
packages/structures/src/voice/VoiceRegion.ts (1)
packages/structures/src/utils/symbols.ts (1)
  • kData (1-1)
packages/structures/src/voice/VoiceState.ts (2)
packages/voice/scripts/postbuild.mjs (1)
  • data (3-3)
packages/structures/src/utils/symbols.ts (1)
  • kData (1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Tests
🔇 Additional comments (3)
packages/structures/src/voice/VoiceRegion.ts (1)

1-58: LGTM!

The VoiceRegion class correctly follows the established structure pattern. All getters properly map to APIVoiceRegion fields via the kData symbol, and the generic type parameter for omitted fields is correctly implemented.

packages/structures/src/voice/VoiceState.ts (1)

1-108: LGTM!

The VoiceState class correctly implements all primitive fields from APIVoiceState with proper snake_case to camelCase conversion. The design decision to defer the nested member (GuildMember) substructure to extending classes is appropriately documented in the JSDoc remarks.

packages/structures/src/voice/index.ts (1)

1-2: LGTM!

Standard barrel file re-exporting both voice structures.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link
Member

@Qjuh Qjuh left a comment

Choose a reason for hiding this comment

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

LGTM apart from the sorting issue in index.ts pointed out by coderabbit.

@vercel vercel bot temporarily deployed to Preview – discord-js-guide January 25, 2026 11:55 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js January 25, 2026 11:55 Inactive
@AsadHumayun AsadHumayun requested a review from Qjuh January 25, 2026 11:55
@github-project-automation github-project-automation bot moved this from Todo to Review Approved in discord.js Jan 27, 2026
@vercel vercel bot temporarily deployed to Preview – discord-js-guide January 27, 2026 23:14 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js January 27, 2026 23:14 Inactive
@kodiakhq kodiakhq bot merged commit b0e413c into discordjs:main Jan 27, 2026
8 checks passed
@github-project-automation github-project-automation bot moved this from Review Approved to Done in discord.js Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants