Skip to content

Commit af485e7

Browse files
committed
🐛 fix(docs): resolve code indentation error due to a wrong push that reverted some files (medium severity incident affecting documentation codeblocks)
1 parent 7e20c54 commit af485e7

216 files changed

Lines changed: 4207 additions & 3845 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

en/cli/cli-database.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ The exact files vary by ORM but the layout follows the same convention for every
140140
Once the command finishes, you can inject _DatabaseService_ into any handler, guard, or service within the same module scope. The service is exported from the database module, so importing _DatabaseModule_ in any other module gives you access to it through the DI container.
141141

142142
```typescript filename="src/modules/hello/hello.service.ts"
143-
import { Injectable } from "@spraxium/common";
144-
import { DatabaseService } from "../database/database.service";
143+
import { Injectable } from '@spraxium/common';
144+
import { DatabaseService } from '../database/database.service';
145145

146146
@Injectable()
147147
export class HelloService {

en/cli/cli-dev.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ spraxium dev
2424
```typescript filename="spraxium.config.ts"
2525
export default {
2626
dev: {
27-
entrypoint: "src/main.ts",
28-
include: ["src/**"],
29-
exclude: ["src/**/*.spec.ts"],
27+
entrypoint: 'src/main.ts',
28+
include: ['src/**'],
29+
exclude: ['src/**/*.spec.ts'],
3030
debounce: 300,
3131
},
3232
};

en/components/components-buttons.mdx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ A static button is the simplest interactive component. You decorate a class with
4949
import { Button } from '@spraxium/components';
5050

5151
@Button({
52-
customId: 'confirm_action', label: 'Confirm', style: 'success', emoji: '', })
52+
customId: 'confirm_action',
53+
label: 'Confirm',
54+
style: 'success',
55+
emoji: '',
56+
})
5357
export class ConfirmButton {}
5458

5559
````
@@ -129,12 +133,12 @@ The handler class must be decorated with _@ButtonHandler_ and pass the component
129133
Link buttons open a URL in the user's browser without firing any handler on the bot side. They are useful for directing users to documentation, dashboards, or external tools. Because Discord requires a different button style for links, the _@LinkButton_ decorator omits _customId_ and _style_ in favor of a _url_ field.
130134
131135
```typescript filename="src/components/buttons/docs-link.button.ts"
132-
import { LinkButton } from "@spraxium/components";
136+
import { LinkButton } from '@spraxium/components';
133137

134138
@LinkButton({
135-
url: "https://docs.example.com",
136-
label: "View Documentation",
137-
emoji: "📖",
139+
url: 'https://docs.example.com',
140+
label: 'View Documentation',
141+
emoji: '📖',
138142
})
139143
export class DocsLinkButton {}
140144
```
@@ -176,13 +180,13 @@ _ButtonService_ is the injectable service that transforms decorated classes into
176180
</Callout>
177181
178182
```typescript filename="src/commands/moderation.command-handler.ts"
179-
import { Ctx, SlashCommandHandler } from "@spraxium/common";
180-
import { ButtonService, ContextService } from "@spraxium/components";
181-
import type { ChatInputCommandInteraction } from "discord.js";
182-
import { ConfirmButton } from "../components/buttons/confirm.button";
183-
import { CancelButton } from "../components/buttons/cancel.button";
184-
import { DocsLinkButton } from "../components/buttons/docs-link.button";
185-
import { ModerationCommand } from "./moderation.command";
183+
import { Ctx, SlashCommandHandler } from '@spraxium/common';
184+
import { ButtonService, ContextService } from '@spraxium/components';
185+
import type { ChatInputCommandInteraction } from 'discord.js';
186+
import { ConfirmButton } from '../components/buttons/confirm.button';
187+
import { CancelButton } from '../components/buttons/cancel.button';
188+
import { DocsLinkButton } from '../components/buttons/docs-link.button';
189+
import { ModerationCommand } from './moderation.command';
186190

187191
@SlashCommandHandler(ModerationCommand)
188192
export class ModerationCommandHandler {
@@ -192,7 +196,7 @@ export class ModerationCommandHandler {
192196
) {}
193197

194198
async handle(@Ctx() interaction: ChatInputCommandInteraction): Promise<void> {
195-
const ctx = await this.context.create({ targetUserId: "123456" });
199+
const ctx = await this.context.create({ targetUserId: '123456' });
196200
const actionRow = this.buttons.rowWithContext(
197201
ctx,
198202
ConfirmButton,
@@ -201,7 +205,7 @@ export class ModerationCommandHandler {
201205
const linkRow = this.buttons.build(DocsLinkButton);
202206

203207
await interaction.reply({
204-
content: "Review the moderation action below.",
208+
content: 'Review the moderation action below.',
205209
components: [actionRow, linkRow],
206210
});
207211
}
@@ -256,10 +260,10 @@ The _style_ field accepts one of four named values that map to Discord's _Button
256260
Only handler classes need to be registered, and they go in the _handlers_ array of your feature module. Component classes decorated with _@Button_ or _@LinkButton_ are metadata-only and are never added to any module. The dispatcher reads their customId and configuration directly from the class reference stored inside each _@ButtonHandler_ decorator, with no DI instantiation required.
257261
258262
```typescript filename="src/modules/moderation/moderation.module.ts"
259-
import { Module } from "@spraxium/common";
260-
import { ConfirmButtonHandler } from "./components/confirm.handler";
261-
import { CancelButtonHandler } from "./components/cancel.handler";
262-
import { UserBanButtonHandler } from "./components/user-ban.handler";
263+
import { Module } from '@spraxium/common';
264+
import { ConfirmButtonHandler } from './components/confirm.handler';
265+
import { CancelButtonHandler } from './components/cancel.handler';
266+
import { UserBanButtonHandler } from './components/user-ban.handler';
263267

264268
@Module({
265269
handlers: [ConfirmButtonHandler, CancelButtonHandler, UserBanButtonHandler],

en/components/components-context.mdx

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ The flow context system is shared across all component types. A context created
2020
Inject _ContextService_ into your command or service and call _create_ with the data object you want to thread through the flow. The method returns a _SpraxiumContext_ with a generated UUID, the data, timestamps, and the TTL. You then pass this context to the component service's build method.
2121

2222
```typescript filename="src/commands/setup-wizard.command-handler.ts"
23-
import { Ctx, SlashCommandHandler } from "@spraxium/common";
24-
import { ContextService, ButtonService } from "@spraxium/components";
25-
import type { ChatInputCommandInteraction } from "discord.js";
26-
import { NextStepButton } from "../components/next-step.button";
27-
import { SetupWizardCommand } from "./setup-wizard.command";
23+
import { Ctx, SlashCommandHandler } from '@spraxium/common';
24+
import { ContextService, ButtonService } from '@spraxium/components';
25+
import type { ChatInputCommandInteraction } from 'discord.js';
26+
import { NextStepButton } from '../components/next-step.button';
27+
import { SetupWizardCommand } from './setup-wizard.command';
2828

2929
@SlashCommandHandler(SetupWizardCommand)
3030
export class SetupWizardCommandHandler {
@@ -42,7 +42,7 @@ export class SetupWizardCommandHandler {
4242
const row = this.buttons.rowWithContext(ctx, NextStepButton);
4343

4444
await interaction.reply({
45-
content: "Welcome to the setup wizard. Click Next to begin.",
45+
content: 'Welcome to the setup wizard. Click Next to begin.',
4646
components: [row],
4747
});
4848
}
@@ -116,10 +116,10 @@ The _SpraxiumContext_ object carries both your custom data and operational metad
116116
Use the _@FlowContext()_ parameter decorator in your handler's _handle_ method to receive the resolved context. The dispatcher extracts the context ID from the _customId_, retrieves the context from the storage adapter, validates expiration and user restrictions, and injects the resolved object. If the context has expired or the user is restricted, the dispatcher replies with the configured error message and does not invoke the handler.
117117

118118
```typescript filename="src/components/next-step.handler.ts"
119-
import { ButtonHandler, Ctx, FlowContext } from "@spraxium/components";
120-
import type { ButtonInteraction } from "discord.js";
121-
import type { SpraxiumContext } from "@spraxium/components";
122-
import { NextStepButton } from "./next-step.button";
119+
import { ButtonHandler, Ctx, FlowContext } from '@spraxium/components';
120+
import type { ButtonInteraction } from 'discord.js';
121+
import type { SpraxiumContext } from '@spraxium/components';
122+
import { NextStepButton } from './next-step.button';
123123

124124
interface WizardData {
125125
step: number;
@@ -147,11 +147,11 @@ export class NextStepButtonHandler {
147147
The _ContextService.update_ method patches the context data without replacing the entire object. This is useful in multi-step flows where each handler adds or modifies a subset of the data. The method returns a boolean indicating whether the update succeeded (context found and not expired).
148148

149149
```typescript filename="src/components/step-two.handler.ts"
150-
import { ButtonHandler, Ctx, FlowContext } from "@spraxium/components";
151-
import { ContextService } from "@spraxium/components";
152-
import type { ButtonInteraction } from "discord.js";
153-
import type { SpraxiumContext } from "@spraxium/components";
154-
import { StepTwoButton } from "./step-two.button";
150+
import { ButtonHandler, Ctx, FlowContext } from '@spraxium/components';
151+
import { ContextService } from '@spraxium/components';
152+
import type { ButtonInteraction } from 'discord.js';
153+
import type { SpraxiumContext } from '@spraxium/components';
154+
import { StepTwoButton } from './step-two.button';
155155

156156
interface WizardData {
157157
step: number;
@@ -169,11 +169,11 @@ export class StepTwoButtonHandler {
169169
): Promise<void> {
170170
await this.context.update<WizardData>(ctx.id, {
171171
step: 2,
172-
settings: { ...ctx.data.settings, language: "en" },
172+
settings: { ...ctx.data.settings, language: 'en' },
173173
});
174174

175175
await interaction.reply({
176-
content: "Step 2 complete. Proceeding to step 3.",
176+
content: 'Step 2 complete. Proceeding to step 3.',
177177
ephemeral: true,
178178
});
179179
}
@@ -185,11 +185,11 @@ export class StepTwoButtonHandler {
185185
Call _ContextService.delete_ when the flow is complete or cancelled. This immediately removes the context from the storage adapter. While contexts expire automatically based on TTL, explicit deletion is good practice for flows that complete normally, as it frees storage and prevents stale data from being read in edge cases.
186186

187187
```typescript filename="src/components/finish-wizard.handler.ts"
188-
import { ButtonHandler, Ctx, FlowContext } from "@spraxium/components";
189-
import { ContextService } from "@spraxium/components";
190-
import type { ButtonInteraction } from "discord.js";
191-
import type { SpraxiumContext } from "@spraxium/components";
192-
import { FinishButton } from "./finish.button";
188+
import { ButtonHandler, Ctx, FlowContext } from '@spraxium/components';
189+
import { ContextService } from '@spraxium/components';
190+
import type { ButtonInteraction } from 'discord.js';
191+
import type { SpraxiumContext } from '@spraxium/components';
192+
import { FinishButton } from './finish.button';
193193

194194
@ButtonHandler(FinishButton)
195195
export class FinishWizardHandler {
@@ -200,7 +200,7 @@ export class FinishWizardHandler {
200200
@FlowContext() ctx: SpraxiumContext<unknown>,
201201
): Promise<void> {
202202
await this.context.delete(ctx.id);
203-
await interaction.reply({ content: "Setup complete!", ephemeral: true });
203+
await interaction.reply({ content: 'Setup complete!', ephemeral: true });
204204
}
205205
}
206206
```
@@ -255,11 +255,11 @@ The context system uses a pluggable storage adapter configured through the _defi
255255
</Table>
256256

257257
```typescript filename="config/components.config.ts"
258-
import { defineComponents } from "@spraxium/components";
258+
import { defineComponents } from '@spraxium/components';
259259

260260
export const componentsPlugin = defineComponents({
261261
context: {
262-
storage: "redis",
262+
storage: 'redis',
263263
defaultTtl: 600,
264264
},
265265
});
@@ -317,11 +317,11 @@ The default TTL is set in the _defineComponents_ configuration. Individual conte
317317
The _restrictedTo_ option limits context access to a specific user ID. When set, only interactions from that user ID are dispatched to the handler. Other users who click the component receive the configured _errorMessages.restricted_ message. This is essential for flows where the component is visible to everyone in a channel but should only be actionable by the user who initiated the command.
318318

319319
```typescript filename="src/commands/verification.command-handler.ts"
320-
import { Ctx, SlashCommandHandler } from "@spraxium/common";
321-
import { ContextService, ButtonService } from "@spraxium/components";
322-
import type { ChatInputCommandInteraction } from "discord.js";
323-
import { VerifyButton } from "../components/verify.button";
324-
import { VerificationCommand } from "./verification.command";
320+
import { Ctx, SlashCommandHandler } from '@spraxium/common';
321+
import { ContextService, ButtonService } from '@spraxium/components';
322+
import type { ChatInputCommandInteraction } from 'discord.js';
323+
import { VerifyButton } from '../components/verify.button';
324+
import { VerificationCommand } from './verification.command';
325325

326326
@SlashCommandHandler(VerificationCommand)
327327
export class VerificationCommandHandler {
@@ -339,7 +339,7 @@ export class VerificationCommandHandler {
339339
const row = this.buttons.rowWithContext(ctx, VerifyButton);
340340

341341
await interaction.reply({
342-
content: "Click the button to verify your identity.",
342+
content: 'Click the button to verify your identity.',
343343
components: [row],
344344
});
345345
}

0 commit comments

Comments
 (0)