@stelliajs/framework 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.prettierrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "plugins": ["@trivago/prettier-plugin-sort-imports"],
3
+ "importOrder": ["^node:", "^[a-z]", "^@", "^[./]"],
4
+ "importOrderSeparation": false,
5
+ "importOrderSortSpecifiers": true,
6
+ "semi": true,
7
+ "singleQuote": false,
8
+ "useTabs": true,
9
+ "tabWidth": 2,
10
+ "trailingComma": "none",
11
+ "printWidth": 100
12
+ }
package/README.md CHANGED
@@ -6,7 +6,9 @@ StelliaJS is built using Discord JS V14 and TypeScript. It allows you to quickly
6
6
  A CLI is available to help you set up a project with StelliaJS : [link to the CLI](https://github.com/StelliaJS/cli)
7
7
 
8
8
  ## Architecture
9
+
9
10
  Recommended architecture for StelliaJS project.
11
+
10
12
  ```
11
13
  .
12
14
  ├── dist // Build folder
@@ -49,45 +51,48 @@ Recommended architecture for StelliaJS project.
49
51
  ### Simple client with environment
50
52
 
51
53
  ```js
52
- import { StelliaClient } from "@stelliajs/framework";
53
54
  import { GatewayIntentBits, Partials } from "discord.js";
55
+ import { StelliaClient } from "@stelliajs/framework";
54
56
 
55
- const client = new StelliaClient({
56
- intents: [
57
- GatewayIntentBits.Guilds,
58
- GatewayIntentBits.GuildMessages,
59
- GatewayIntentBits.MessageContent,
60
- GatewayIntentBits.GuildMembers
61
- ],
62
- partials: [Partials.Message, Partials.GuildMember]
63
- }, {
64
- managers: {
65
- autoCompletes: {
66
- directoryPath: "./interactions/autoCompletes"
67
- },
68
- buttons: {
69
- directoryPath: "./interactions/buttons"
70
- },
71
- commands: {
72
- directoryPath: "./commands/slash"
73
- },
74
- contextMenus: {
75
- directoryPath: "./commands/contextMenus"
76
- },
77
- events: {
78
- directoryPath: "./events"
79
- },
80
- modals: {
81
- directoryPath: "./interactions/modals"
82
- },
83
- selectMenus: {
84
- directoryPath: "./interactions/selectMenus"
85
- }
86
- },
87
- environment: {
88
- areGuildsConfigurationEnabled: true
89
- }
90
- });
57
+ const client = new StelliaClient(
58
+ {
59
+ intents: [
60
+ GatewayIntentBits.Guilds,
61
+ GatewayIntentBits.GuildMessages,
62
+ GatewayIntentBits.MessageContent,
63
+ GatewayIntentBits.GuildMembers
64
+ ],
65
+ partials: [Partials.Message, Partials.GuildMember]
66
+ },
67
+ {
68
+ managers: {
69
+ autoCompletes: {
70
+ directoryPath: "./interactions/autoCompletes"
71
+ },
72
+ buttons: {
73
+ directoryPath: "./interactions/buttons"
74
+ },
75
+ commands: {
76
+ directoryPath: "./commands/slash"
77
+ },
78
+ contextMenus: {
79
+ directoryPath: "./commands/contextMenus"
80
+ },
81
+ events: {
82
+ directoryPath: "./events"
83
+ },
84
+ modals: {
85
+ directoryPath: "./interactions/modals"
86
+ },
87
+ selectMenus: {
88
+ directoryPath: "./interactions/selectMenus"
89
+ }
90
+ },
91
+ environment: {
92
+ areGuildsConfigurationEnabled: true
93
+ }
94
+ }
95
+ );
91
96
 
92
97
  await client.connect(process.env.TOKEN);
93
98
  ```
@@ -95,6 +100,7 @@ await client.connect(process.env.TOKEN);
95
100
  ### Simple event
96
101
 
97
102
  #### Ready event with environment
103
+
98
104
  ```js
99
105
  import { type StelliaClient, type EventStructure } from "@stelliajs/framework";
100
106
  import { Events } from "discord.js";
@@ -113,6 +119,7 @@ export default {
113
119
  ```
114
120
 
115
121
  #### InteractionCreate event with environment
122
+
116
123
  ```js
117
124
  import { type StelliaClient, type EventStructure } from "@stelliajs/framework";
118
125
  import { Events, type Interaction } from "discord.js";
@@ -147,7 +154,6 @@ export default {
147
154
  } as CommandStructure;
148
155
  ```
149
156
 
150
-
151
157
  ## Help
152
158
 
153
159
  If you need help with the framework you can open an issue.
@@ -1,9 +1,9 @@
1
+ import * as fs from "node:fs";
1
2
  import { Client } from "discord.js";
2
- import { AutoCompleteManager, ButtonManager, CommandManager, ContextMenuManager, EventManager, ModalManager, SelectMenuManager } from "../managers/index.js";
3
- import { StelliaUtils } from "./index.js";
4
3
  import path from "path";
5
- import * as fs from "node:fs";
6
4
  import { pathToFileURL } from "url";
5
+ import { StelliaUtils } from "./index.js";
6
+ import { AutoCompleteManager, ButtonManager, CommandManager, ContextMenuManager, EventManager, ModalManager, SelectMenuManager } from "../managers/index.js";
7
7
  import { logger } from "../utils/logger.js";
8
8
  export class StelliaClient extends Client {
9
9
  utils;
@@ -58,7 +58,7 @@ export class StelliaClient extends Client {
58
58
  await this.utils.initializeCommands();
59
59
  };
60
60
  getGuildsConfiguration = async () => {
61
- const chosenEnvironment = process.argv.find(arg => arg.startsWith("--config"))?.split("=")[1];
61
+ const chosenEnvironment = process.argv.find((arg) => arg.startsWith("--config"))?.split("=")[1];
62
62
  if (!chosenEnvironment) {
63
63
  throw new Error("Environment not provided");
64
64
  }
@@ -1,5 +1,5 @@
1
- import { type StelliaClient } from "./index.js";
2
1
  import { type Interaction } from "discord.js";
2
+ import { type StelliaClient } from "./index.js";
3
3
  import { type GuildConfiguration } from "../typescript/index.js";
4
4
  export declare class StelliaUtils {
5
5
  readonly client: StelliaClient;
@@ -17,7 +17,8 @@ export class StelliaUtils {
17
17
  [InteractionType.SelectMenu, this.handleSelectMenuInteraction]
18
18
  ]);
19
19
  if (this.client.environment.areGuildsConfigurationEnabled) {
20
- this.client.getGuildsConfiguration()
20
+ this.client
21
+ .getGuildsConfiguration()
21
22
  .then((guildsConfiguration) => {
22
23
  this.guildsConfiguration = guildsConfiguration;
23
24
  logger.success("Guilds configuration loaded successfully for interactions");
@@ -32,7 +33,9 @@ export class StelliaUtils {
32
33
  if (this.client.isReady()) {
33
34
  const rest = new REST({ version: DISCORD_API_VERSION }).setToken(this.client.token);
34
35
  try {
35
- await rest.put(Routes.applicationCommands(this.client.user.id), { body: applicationCommands });
36
+ await rest.put(Routes.applicationCommands(this.client.user.id), {
37
+ body: applicationCommands
38
+ });
36
39
  logger.success("Application commands registered successfully");
37
40
  }
38
41
  catch (error) {
@@ -92,7 +95,8 @@ export class StelliaUtils {
92
95
  const buttonManager = this.client.managers.buttons;
93
96
  if (!buttonManager)
94
97
  return;
95
- const button = buttonManager.getByCustomId(buttonInteraction.customId) || buttonManager.getByRegex(buttonInteraction.customId);
98
+ const button = buttonManager.getByCustomId(buttonInteraction.customId) ||
99
+ buttonManager.getByRegex(buttonInteraction.customId);
96
100
  if (!button)
97
101
  return;
98
102
  if (this.client.environment.areGuildsConfigurationEnabled) {
@@ -154,7 +158,8 @@ export class StelliaUtils {
154
158
  const modalManager = this.client.managers.modals;
155
159
  if (!modalManager)
156
160
  return;
157
- const modal = modalManager.getByCustomId(modalInteraction.customId) || modalManager.getByRegex(modalInteraction.customId);
161
+ const modal = modalManager.getByCustomId(modalInteraction.customId) ||
162
+ modalManager.getByRegex(modalInteraction.customId);
158
163
  if (!modal)
159
164
  return;
160
165
  if (this.client.environment.areGuildsConfigurationEnabled) {
@@ -177,7 +182,8 @@ export class StelliaUtils {
177
182
  const selectMenuManager = this.client.managers.selectMenus;
178
183
  if (!selectMenuManager)
179
184
  return;
180
- const selectMenu = selectMenuManager.getByCustomId(selectMenuInteraction.customId) || selectMenuManager.getByRegex(selectMenuInteraction.customId);
185
+ const selectMenu = selectMenuManager.getByCustomId(selectMenuInteraction.customId) ||
186
+ selectMenuManager.getByRegex(selectMenuInteraction.customId);
181
187
  if (!selectMenu)
182
188
  return;
183
189
  if (this.client.environment.areGuildsConfigurationEnabled) {
@@ -1,7 +1,7 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
4
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
5
  export declare class AutoCompleteManager extends BaseManager {
6
6
  private interactions;
7
7
  constructor(client: StelliaClient, directory: string);
@@ -1,7 +1,7 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
4
3
  import { type AnyInteractionStructure } from "../structures/index.js";
4
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
5
  export interface ManagerOptions {
6
6
  directoryPath: string;
7
7
  }
@@ -2,7 +2,7 @@ import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
4
  import { type ButtonStructure } from "../structures/index.js";
5
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
5
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
6
6
  export declare class ButtonManager extends BaseManager {
7
7
  interactions: Collection<StructureCustomId, ButtonStructure>;
8
8
  constructor(client: StelliaClient, directory: string);
@@ -1,7 +1,7 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
4
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
5
  export declare class CommandManager extends BaseManager {
6
6
  private interactions;
7
7
  constructor(client: StelliaClient, directory: string);
@@ -1,7 +1,7 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
4
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
5
  export declare class ContextMenuManager extends BaseManager {
6
6
  private interactions;
7
7
  constructor(client: StelliaClient, directory: string);
@@ -1,7 +1,7 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
4
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
5
  export declare class EventManager extends BaseManager {
6
6
  private interactions;
7
7
  private guildsConfiguration;
@@ -8,7 +8,8 @@ export class EventManager extends BaseManager {
8
8
  constructor(client, directoryPath) {
9
9
  super(client, directoryPath);
10
10
  if (this.client.environment.areGuildsConfigurationEnabled) {
11
- this.client.getGuildsConfiguration()
11
+ this.client
12
+ .getGuildsConfiguration()
12
13
  .then((guildsConfiguration) => {
13
14
  this.guildsConfiguration = guildsConfiguration;
14
15
  logger.success("Guilds configuration loaded successfully for event");
@@ -1,7 +1,7 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
4
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
5
  export declare class ModalManager extends BaseManager {
6
6
  private interactions;
7
7
  constructor(client: StelliaClient, directory: string);
@@ -1,7 +1,7 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
- import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
4
+ import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
5
  export declare class SelectMenuManager extends BaseManager {
6
6
  private interactions;
7
7
  constructor(client: StelliaClient, directory: string);
@@ -1,7 +1,7 @@
1
- import { type AnySelectMenuInteraction, type AutocompleteInteraction, type Awaitable, type ButtonInteraction, type ChatInputCommandInteraction, type ContextMenuCommandType, type MessageContextMenuCommandInteraction, type ModalSubmitInteraction, type SlashCommandOptionsOnlyBuilder, type UserContextMenuCommandInteraction } from "discord.js";
1
+ import { type AnySelectMenuInteraction, type AutocompleteInteraction, type Awaitable, type ButtonInteraction, type ChatInputCommandInteraction, type ContextMenuCommandType, type MessageContextMenuCommandInteraction, type ModalSubmitInteraction, type SlashCommandOptionsOnlyBuilder, type SlashCommandSubcommandsOnlyBuilder, type UserContextMenuCommandInteraction } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
- import { type GuildConfigurationType } from "../typescript/index.js";
4
3
  import { type EventStructure } from "./Event.js";
4
+ import { type GuildConfigurationType } from "../typescript/index.js";
5
5
  export interface AutoCompleteStructureWithGuildConfiguration extends MessageInteractionStructure {
6
6
  execute(client: StelliaClient, guildConfiguration: GuildConfigurationType, interaction: AutocompleteInteraction<"cached">): Awaitable<unknown>;
7
7
  }
@@ -46,7 +46,7 @@ export interface SelectMenuStructureWithoutGuildConfiguration extends MessageInt
46
46
  export type SelectMenuStructure = SelectMenuStructureWithGuildConfiguration | SelectMenuStructureWithoutGuildConfiguration;
47
47
  export type AnyInteractionStructure = AutoCompleteStructure | ButtonStructure | CommandStructure | ContextMenuStructure | EventStructure | ModalStructure | SelectMenuStructure;
48
48
  interface CommandInteractionStructure {
49
- data: SlashCommandOptionsOnlyBuilder;
49
+ data: SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder;
50
50
  }
51
51
  interface ContextMenuInteractionStructure {
52
52
  data: ContextMenuDataStructure;
@@ -1,5 +1,5 @@
1
- import { type AutoCompleteManager, type ButtonManager, type CommandManager, type ContextMenuManager, type EventManager, type ModalManager, type SelectMenuManager } from "../managers/index.js";
2
1
  import { type Locale, type Snowflake } from "discord.js";
2
+ import { type AutoCompleteManager, type ButtonManager, type CommandManager, type ContextMenuManager, type EventManager, type ModalManager, type SelectMenuManager } from "../managers/index.js";
3
3
  export type StructureCustomId = string | RegExp;
4
4
  export type InteractionCustomId = string;
5
5
  export declare enum InteractionType {
package/package.json CHANGED
@@ -1,29 +1,43 @@
1
1
  {
2
- "name": "@stelliajs/framework",
3
- "version": "1.4.5",
4
- "main": "./dist/index.js",
5
- "types": "./dist/index.d.ts",
6
- "scripts": {
7
- "build": "tsc && tsc-alias"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/stelliajs/framework.git"
12
- },
13
- "author": "Tweenty_",
14
- "license": "ISC",
15
- "description": "A framework for simplify the creation of discord bots",
16
- "keywords": ["discord", "bot", "discordjs", "typescript", "framework"],
17
- "dependencies": {
18
- "discord-api-types": "^0.38.11",
19
- "discord.js": "^14.21.0",
20
- "i18next": "^25.3.0",
21
- "log-symbols": "^7.0.1"
22
- },
23
- "devDependencies": {
24
- "ts-node": "^10.9.2",
25
- "tsc-alias": "^1.8.16"
26
- },
27
- "type": "module",
28
- "packageManager": "pnpm@10.12.4"
2
+ "name": "@stelliajs/framework",
3
+ "version": "1.4.6",
4
+ "main": "./dist/index.js",
5
+ "types": "./dist/index.d.ts",
6
+ "scripts": {
7
+ "lint": "eslint . --ext .js",
8
+ "format": "prettier --write .",
9
+ "build": "tsc && tsc-alias"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/stelliajs/framework.git"
14
+ },
15
+ "author": "Tweenty_",
16
+ "license": "ISC",
17
+ "description": "A framework for simplify the creation of discord bots",
18
+ "keywords": [
19
+ "discord",
20
+ "bot",
21
+ "discordjs",
22
+ "typescript",
23
+ "framework"
24
+ ],
25
+ "dependencies": {
26
+ "discord.js": "^14.21.0",
27
+ "i18next": "^25.3.2",
28
+ "log-symbols": "^7.0.1"
29
+ },
30
+ "devDependencies": {
31
+ "@eslint/js": "^9.32.0",
32
+ "@trivago/prettier-plugin-sort-imports": "^5.2.2",
33
+ "eslint": "^9.32.0",
34
+ "discord-api-types": "^0.38.16",
35
+ "globals": "^16.3.0",
36
+ "prettier": "^3.6.2",
37
+ "ts-node": "^10.9.2",
38
+ "tsc-alias": "^1.8.16",
39
+ "typescript-eslint": "^8.38.0"
40
+ },
41
+ "type": "module",
42
+ "packageManager": "pnpm@10.14.0"
29
43
  }