Skip to content

Commit bc290e5

Browse files
committed
🐛 fix(repo): fix remaning files
1 parent af485e7 commit bc290e5

50 files changed

Lines changed: 453 additions & 499 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/env/env-advanced.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ import { SpraxiumBaseEnv } from '@spraxium/env';
4545

4646
@EnvSchema()
4747
export class BaseEnv extends SpraxiumBaseEnv {
48-
@Env('LOG_LEVEL', { default: 'info', secret: false })
49-
@IsString()
50-
LOG_LEVEL!: string;
51-
52-
@Env('SENTRY_DSN')
53-
@IsString()
54-
@IsOptional()
55-
SENTRY_DSN?: string;
48+
@Env('LOG_LEVEL', { default: 'info', secret: false })
49+
@IsString()
50+
LOG_LEVEL!: string;
51+
52+
@Env('SENTRY_DSN')
53+
@IsString()
54+
@IsOptional()
55+
SENTRY_DSN?: string;
5656
}
5757

5858
````

en/getting-started/getting-started.mdx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,19 @@ The fastest way to start is through the official create command, which generates
4242

4343
<CodeTabs>
4444
<Tab label="npm" language="bash">
45-
```bash npx spraxium@latest new my-bot ```
45+
```bash
46+
npx spraxium@latest new my-bot
47+
```
4648
</Tab>
4749
<Tab label='pnpm' language='bash'>
48-
```bash pnpm create spraxium@latest my-bot ```
50+
```bash
51+
pnpm create spraxium@latest my-bot
52+
```
4953
</Tab>
5054
<Tab label='bun' language='bash'>
51-
```bash bunx spraxium@latest new my-bot ```
55+
```bash
56+
bunx spraxium@latest new my-bot
57+
```
5258
</Tab>
5359
</CodeTabs>
5460

@@ -58,12 +64,12 @@ The scaffolded project follows a convention that Spraxium enforces throughout yo
5864

5965
<FolderStructure title='Minimal structure'>
6066
<Folder name='src' open>
61-
<File name='main.ts' comment='Bootstrap and application startup' />
62-
<File name='app.env.ts' comment='Typed environment variable schema' />
63-
<File name='app.module.ts' comment='Root module that composes features' />
67+
<File name='main.ts' />
68+
<File name='app.env.ts' />
69+
<File name='app.module.ts' />
6470
<Folder name='modules' open>
6571
<Folder name='default' open>
66-
<File name='default.module.ts' comment='First feature module' />
72+
<File name='default.module.ts' />
6773
</Folder>
6874
</Folder>
6975
</Folder>

en/http/http-folder-architecture.mdx

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,72 +19,36 @@ This matters more in HTTP modules than in typical Discord command code because H
1919

2020
<FolderStructure title="Suggested HTTP architecture">
2121
<Folder name="src" open>
22-
<File
23-
name="app.module.ts"
24-
comment="Imports HttpModule, hosts @HttpClientModule with controllers/services/guards/middleware"
25-
/>
26-
<File name="main.ts" comment="Application bootstrap entry point" />
22+
<File name="app.module.ts" />
23+
<File name="main.ts" />
2724
<Folder name="http" open>
2825
<Folder name="controllers" open>
29-
<File
30-
name="guild-http.controller.ts"
31-
comment="Route contracts, parameter mapping, and response shaping"
32-
/>
33-
<File
34-
name="moderation-http.controller.ts"
35-
comment="Ban, kick, timeout, and role management endpoints"
36-
/>
26+
<File name="guild-http.controller.ts" />
27+
<File name="moderation-http.controller.ts" />
3728
</Folder>
3829
<Folder name="services" open>
39-
<File
40-
name="guild-http.service.ts"
41-
comment="Business operations shared by guild routes, injects BotBridge and AppEnv"
42-
/>
43-
<File
44-
name="moderation-http.service.ts"
45-
comment="Moderation logic consuming BotBridge"
46-
/>
30+
<File name="guild-http.service.ts" />
31+
<File name="moderation-http.service.ts" />
4732
</Folder>
4833
<Folder name="guards" open>
49-
<File
50-
name="admin.guard.ts"
51-
comment="Custom DI-resolved guard for admin endpoints"
52-
/>
34+
<File name="admin.guard.ts" />
5335
</Folder>
5436
<Folder name="dto" open>
55-
<File
56-
name="update-guild-config.dto.ts"
57-
comment="Validation contract for guild config PATCH"
58-
/>
59-
<File
60-
name="ban-member.dto.ts"
61-
comment="Validation contract for ban POST"
62-
/>
37+
<File name="update-guild-config.dto.ts" />
38+
<File name="ban-member.dto.ts" />
6339
</Folder>
6440
<Folder name="middleware" open>
65-
<File
66-
name="request-audit.middleware.ts"
67-
comment="Route-level middleware for audit logging"
68-
/>
41+
<File name="request-audit.middleware.ts" />
6942
</Folder>
7043
<Folder name="errors" open>
71-
<File
72-
name="guild-locked.error.ts"
73-
comment="Custom ForbiddenError subclass for locked guilds"
74-
/>
44+
<File name="guild-locked.error.ts" />
7545
</Folder>
7646
</Folder>
7747
</Folder>
7848
<Folder name="config" open>
79-
<File
80-
name="http.config.ts"
81-
comment="Single defineHttp entry exported as httpPlugin"
82-
/>
49+
<File name="http.config.ts" />
8350
</Folder>
84-
<File
85-
name="spraxium.config.ts"
86-
comment="Registers httpPlugin in defineConfig plugins"
87-
/>
51+
<File name="spraxium.config.ts" />
8852
</FolderStructure>
8953

9054
## Role of each folder

en/i18n/i18n-store.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,11 @@ in teardown hooks to keep tests isolated:
308308
import { I18nStoreRegistry, MemoryStore } from '@spraxium/i18n';
309309

310310
beforeEach(() => {
311-
I18nStoreRegistry.set(new MemoryStore());
311+
I18nStoreRegistry.set(new MemoryStore());
312312
});
313313

314314
afterEach(() => {
315-
I18nStoreRegistry.reset();
315+
I18nStoreRegistry.reset();
316316
});
317317

318318
````
@@ -337,20 +337,20 @@ import { I18nStoreRegistry } from '@spraxium/i18n';
337337
import { vi } from 'vitest';
338338

339339
const mockStore = {
340-
init: vi.fn().mockResolvedValue(undefined),
341-
getUser: vi.fn().mockResolvedValue('pt-BR'),
342-
setUser: vi.fn().mockResolvedValue(undefined),
343-
getGuild: vi.fn().mockResolvedValue(undefined),
344-
setGuild: vi.fn().mockResolvedValue(undefined),
340+
init: vi.fn().mockResolvedValue(undefined),
341+
getUser: vi.fn().mockResolvedValue('pt-BR'),
342+
setUser: vi.fn().mockResolvedValue(undefined),
343+
getGuild: vi.fn().mockResolvedValue(undefined),
344+
setGuild: vi.fn().mockResolvedValue(undefined),
345345
};
346346

347347
beforeEach(() => {
348-
I18nStoreRegistry.set(mockStore);
348+
I18nStoreRegistry.set(mockStore);
349349
});
350350

351351
afterEach(() => {
352-
I18nStoreRegistry.reset();
353-
vi.clearAllMocks();
352+
I18nStoreRegistry.reset();
353+
vi.clearAllMocks();
354354
});
355355

356356
```

en/logger/logger-transports.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ import type { SpraxiumLoggerConfig } from '@spraxium/core';
8585

8686
export const loggerConfig: SpraxiumLoggerConfig = {
8787
discord: {
88-
type: 'channel', channelId: '1234567890123456789', levels: ['error', 'warn'], }, };
88+
type: 'channel',
89+
channelId: '1234567890123456789',
90+
levels: ['error', 'warn'],
91+
},
92+
};
8993
```
9094
</Tab>
9195
<Tab label="Webhook mode" language="typescript">
@@ -94,7 +98,11 @@ import type { SpraxiumLoggerConfig } from '@spraxium/core';
9498

9599
export const loggerConfig: SpraxiumLoggerConfig = {
96100
discord: {
97-
type: 'webhook', webhookUrl: 'https://discord.com/api/webhooks/123/abc', levels: ['error'], }, };
101+
type: 'webhook',
102+
webhookUrl: 'https://discord.com/api/webhooks/123/abc',
103+
levels: ['error'],
104+
},
105+
};
98106
```
99107
</Tab>
100108
</CodeTabs>

en/prefix-commands/prefix-commands-arguments-parsing.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import { PrefixArg, PrefixCommand } from '@spraxium/common';
2626

2727
@PrefixCommand({ name: 'roll', cooldown: 3 })
2828
export class RollCommand {
29-
@PrefixArg.Integer('sides', { required: false, min: 2, max: 1000 })
30-
@PrefixArg.Integer('count', { required: false, min: 1, max: 25 })
31-
build() {}
29+
@PrefixArg.Integer('sides', { required: false, min: 2, max: 1000 })
30+
@PrefixArg.Integer('count', { required: false, min: 1, max: 25 })
31+
build() {}
3232
}
3333

3434
````

en/prefix-commands/prefix-commands-definition.mdx

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ The simplest prefix command needs one command class with an argument schema and
2525
import { PrefixArg, PrefixCommand } from '@spraxium/common';
2626

2727
@PrefixCommand({
28-
name: 'roll',
29-
aliases: ['r', 'dice'],
30-
description: 'Roll one or more dice.',
31-
category: 'Fun',
32-
usage: '!roll [sides] [count]',
33-
cooldown: 3,
28+
name: 'roll',
29+
aliases: ['r', 'dice'],
30+
description: 'Roll one or more dice.',
31+
category: 'Fun',
32+
usage: '!roll [sides] [count]',
33+
cooldown: 3,
3434
})
3535
export class RollCommand {
36-
@PrefixArg.Integer('sides', { required: false, min: 2, max: 1000 })
37-
@PrefixArg.Integer('count', { required: false, min: 1, max: 25 })
38-
build() {}
36+
@PrefixArg.Integer('sides', { required: false, min: 2, max: 1000 })
37+
@PrefixArg.Integer('count', { required: false, min: 1, max: 25 })
38+
build() {}
3939
}
4040

4141
````
@@ -78,23 +78,27 @@ For command families like `!mod warn`, `!mod kick`, and `!mod ban`, use _@Prefix
7878
import { PrefixArg, PrefixCommand, PrefixSubcommand } from '@spraxium/common';
7979

8080
@PrefixCommand({
81-
name: 'mod', aliases: ['m'], description: 'Moderation commands.', category: 'Moderation', usage: '!mod <warn|kick|ban> <user> [reason]',
81+
name: 'mod',
82+
aliases: ['m'],
83+
description: 'Moderation commands.',
84+
category: 'Moderation',
85+
usage: '!mod <warn|kick|ban> <user> [reason]',
8286
})
8387
export class ModCommand {
84-
@PrefixSubcommand({ name: 'warn', description: 'Warn a user' })
85-
@PrefixArg.User('target')
86-
@PrefixArg.Rest('reason', { required: false })
87-
warn() {}
88-
89-
@PrefixSubcommand({ name: 'kick', description: 'Kick a user' })
90-
@PrefixArg.User('target')
91-
@PrefixArg.Rest('reason', { required: false })
92-
kick() {}
93-
94-
@PrefixSubcommand({ name: 'ban', description: 'Ban a user' })
95-
@PrefixArg.User('target')
96-
@PrefixArg.Rest('reason', { required: false })
97-
ban() {}
88+
@PrefixSubcommand({ name: 'warn', description: 'Warn a user' })
89+
@PrefixArg.User('target')
90+
@PrefixArg.Rest('reason', { required: false })
91+
warn() {}
92+
93+
@PrefixSubcommand({ name: 'kick', description: 'Kick a user' })
94+
@PrefixArg.User('target')
95+
@PrefixArg.Rest('reason', { required: false })
96+
kick() {}
97+
98+
@PrefixSubcommand({ name: 'ban', description: 'Ban a user' })
99+
@PrefixArg.User('target')
100+
@PrefixArg.Rest('reason', { required: false })
101+
ban() {}
98102
}
99103

100104
````

en/prefix-commands/prefix-commands-execution-guild-prefixes.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ import { PrefixArg, PrefixCommand } from '@spraxium/common';
178178

179179
@PrefixCommand({ name: 'set-prefix' })
180180
export class SetPrefixCommand {
181-
@PrefixArg.String('newPrefix', { minLength: 1, maxLength: 5 })
182-
build() {}
181+
@PrefixArg.String('newPrefix', { minLength: 1, maxLength: 5 })
182+
build() {}
183183
}
184184

185185
````

en/prefix-commands/prefix-commands-overview.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@ Here are two classes that show the two-class pattern. The first is a command def
2525
import { PrefixCommand } from '@spraxium/common';
2626

2727
@PrefixCommand({
28-
name: 'ping', aliases: ['p'], description: 'Check bot latency.', category: 'Fun', usage: '!ping', cooldown: 3,
28+
name: 'ping',
29+
aliases: ['p'],
30+
description: 'Check bot latency.',
31+
category: 'Fun',
32+
usage: '!ping',
33+
cooldown: 3,
2934
})
3035
export class PingCommand {
31-
build() {}
36+
build() {}
3237
}
3338

3439
````

en/prefix-commands/prefix-commands-runtime-testing.mdx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ import { defineExceptionLayout } from '@spraxium/core';
5454
import { ArgumentException } from '@spraxium/common';
5555

5656
export const ArgumentExceptionLayout = defineExceptionLayout(
57-
ArgumentException, async (message, exception) => {
57+
ArgumentException,
58+
async (message, exception) => {
5859
await message.reply({
59-
content: `Invalid argument: **${exception.argName}** - ${exception.message}`, });
60+
content: `Invalid argument: **${exception.argName}** - ${exception.message}`,
61+
});
6062
},
6163
);
6264
```
@@ -67,9 +69,11 @@ import { defineExceptionLayout } from '@spraxium/core';
6769
import { CommandNotFoundException } from '@spraxium/common';
6870

6971
export const CommandNotFoundLayout = defineExceptionLayout(
70-
CommandNotFoundException, async (message, exception) => {
72+
CommandNotFoundException,
73+
async (message, exception) => {
7174
await message.reply({
72-
content: `Command \`${exception.commandName}\` not found. Use \`!help\` to see available commands.`, });
75+
content: `Command \`${exception.commandName}\` not found. Use \`!help\` to see available commands.`,
76+
});
7377
},
7478
);
7579
```
@@ -117,7 +121,7 @@ export class HelpHandler {
117121
? `**${cmd.name}** - subcommands: ${subs}`
118122
: `**${cmd.name}**`;
119123
});
120-
await message.reply(lines.join("\n') || 'No commands registered.");
124+
await message.reply(lines.join('\n') || 'No commands registered.');
121125
}
122126
}
123127
```

0 commit comments

Comments
 (0)