Skip to content

Components v2 integration#7

Merged
Ntalcme merged 4 commits into
mainfrom
components-v2-integration
Jun 4, 2026
Merged

Components v2 integration#7
Ntalcme merged 4 commits into
mainfrom
components-v2-integration

Conversation

@Ntalcme

@Ntalcme Ntalcme commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@Ntalcme Ntalcme self-assigned this Jun 4, 2026
@Ntalcme Ntalcme added the feature New feature or request label Jun 4, 2026
@Ntalcme Ntalcme linked an issue Jun 4, 2026 that may be closed by this pull request
2 tasks
@Ntalcme Ntalcme added the priority: low Nice to have label Jun 4, 2026
@Ntalcme Ntalcme added this to the v0.1.0 milestone Jun 4, 2026
@Ntalcme Ntalcme marked this pull request as ready for review June 4, 2026 16:26
Copilot AI review requested due to automatic review settings June 4, 2026 16:26
@Ntalcme Ntalcme merged commit d52fe10 into main Jun 4, 2026
1 check passed
@Ntalcme Ntalcme deleted the components-v2-integration branch June 4, 2026 16:29

Copilot AI left a comment

Copy link
Copy Markdown

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 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 a Container builder to assemble and flag V2 messages.
  • Updated /ping command + translations to output a structured V2 message (title + separator + body).
  • Fixed base-loader path 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request priority: low Nice to have

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embed helpers

2 participants