Components v2 integration#7
Merged
Merged
Conversation
Closed
2 tasks
There was a problem hiding this comment.
Pull request overview
This PR introduces a small Components V2 abstraction layer (Container + component wrappers) and updates the /ping command to render its response using Discord Components V2 instead of plain text.
Changes:
- Added V2 component wrappers (
Text,Title,Footer,Separator) plus aContainerbuilder to assemble and flag V2 messages. - Updated
/pingcommand + translations to output a structured V2 message (title + separator + body). - Fixed
base-loaderpath resolution and clarified module file filtering.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/components/component.ts | Defines the V2 component discriminated union and interfaces. |
| src/lib/components/container.ts | Provides a Container builder that assembles V2 components and sets the V2 message flag. |
| src/lib/components/title.ts | Adds a title wrapper implemented as a markdown header in a text display. |
| src/lib/components/text.ts | Adds a basic text wrapper for V2 text display components. |
| src/lib/components/separator.ts | Adds a separator wrapper for V2 separator components. |
| src/lib/components/footer.ts | Adds a footer-like wrapper implemented as subtle markdown text. |
| src/lang/ping.ts | Adjusts ping copy to split title vs. result body. |
| src/handlers/base-loader.ts | Fixes directory path construction and clarifies which files are treated as modules. |
| src/commands/slash/ping.ts | Switches ping output to Components V2 using the new builder/wrappers. |
| package.json | Updates package version metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
+26
| /** Escape hatch: wraps any native component the model doesn't cover | ||
| * (sections, galleries, buttons...). "apply" adds it to the container | ||
| *directly, since each native type needs its own add method. | ||
| */ |
Comment on lines
1
to
2
| import { SlashCommandBuilder } from 'discord.js'; | ||
| import type { SlashCommand } from '@/types/command.js'; | ||
| import { pingMessages } from '@/lang/index.js'; |
Comment on lines
15
to
+29
| const before = Date.now(); | ||
|
|
||
| await interaction.reply({ content: pingMessages.calculating }); | ||
|
|
||
| await interaction.deferReply(); | ||
| const totalLatency = Date.now() - before; | ||
|
|
||
| const discordLatency = Math.round(interaction.client.ws.ping); | ||
|
|
||
| await interaction.editReply( | ||
| pingMessages.result(totalLatency, discordLatency), | ||
| ); | ||
| const message = new Container() | ||
| .color('info') | ||
| .add( | ||
| new Title(pingMessages.title), | ||
| new Separator(), | ||
| new Text(pingMessages.result(totalLatency, discordLatency)), | ||
| ) | ||
| .build(); | ||
|
|
||
| await interaction.editReply(message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.