@stelliajs/framework 1.0.3 → 1.0.5

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/README.md CHANGED
@@ -5,6 +5,39 @@
5
5
  StelliaJS is built using Discord JS V14 and TypeScript. It allows you to quickly set up a new bot with a simple and complete architecture.
6
6
  A CLI is currently being developed and will soon be available for even greater convenience.
7
7
 
8
+ ## Architecture
9
+ Recommended architecture for StelliaJS project.
10
+ ```
11
+ .
12
+ ├── dist // Build folder
13
+ ├── src/
14
+ │ ├── commands/
15
+ │ │ ├── contextMenus/
16
+ │ │ │ └── mute.ts
17
+ │ │ └── slash/
18
+ │ │ ├── moderation // You can create folders, everything is loaded recursively
19
+ │ │ │ ├── ban.ts
20
+ │ │ │ └── mute.ts
21
+ │ │ └── ping.ts
22
+ │ ├── events/
23
+ │ │ ├── ready.ts
24
+ │ │ └── interactionCreate.ts
25
+ │ ├── interactions/
26
+ │ │ ├── autoCompletes/
27
+ │ │ │ └── song.ts
28
+ │ │ ├── buttons/
29
+ │ │ │ └── colorChoice.ts
30
+ │ │ ├── modals/
31
+ │ │ │ └── form.ts
32
+ │ │ └── selectMenus/
33
+ │ │ └── settings.ts
34
+ │ ├── environment.d.ts
35
+ │ └── index.ts
36
+ ├── .env
37
+ ├── package.json
38
+ ├── package-lock.json
39
+ └── tsconfig.json
40
+ ```
8
41
  ## Examples
9
42
 
10
43
  ### Simple client
@@ -24,25 +57,25 @@ const client = new StelliaClient({
24
57
  partials: [Partials.Message, Partials.GuildMember]
25
58
  }, {
26
59
  autoCompletes: {
27
- directoryPath: "./src/interactions/autoCompletes"
60
+ directoryPath: "./interactions/autoCompletes"
28
61
  },
29
62
  buttons: {
30
- directoryPath: "./src/interactions/buttons"
63
+ directoryPath: "./interactions/buttons"
31
64
  },
32
65
  commands: {
33
- directoryPath: "./src/commands/slash"
66
+ directoryPath: "./commands/slash"
34
67
  },
35
68
  contextMenus: {
36
- directoryPath: "./src/commands/contextMenus"
69
+ directoryPath: "./commands/contextMenus"
37
70
  },
38
71
  events: {
39
- directoryPath: "./src/events"
72
+ directoryPath: "./events"
40
73
  },
41
74
  modals: {
42
- directoryPath: "./src/interactions/modals"
75
+ directoryPath: "./interactions/modals"
43
76
  },
44
77
  selectMenus: {
45
- directoryPath: "./src/interactions/selectMenus"
78
+ directoryPath: "./interactions/selectMenus"
46
79
  }
47
80
  });
48
81
 
@@ -51,6 +84,7 @@ await client.connect(process.env.TOKEN);
51
84
 
52
85
  ### Simple event
53
86
 
87
+ #### Ready event
54
88
  ```js
55
89
  import { type StelliaClient, type EventStructure } from "@stelliajs/framework";
56
90
  import { Events } from "discord.js";
@@ -67,6 +101,24 @@ export default {
67
101
  } as EventStructure;
68
102
  ```
69
103
 
104
+ #### InteractionCreate event
105
+ ```js
106
+ import { type StelliaClient, type EventStructure } from "@stelliajs/framework";
107
+ import { Events, type Interaction } from "discord.js";
108
+
109
+ export default {
110
+ data: {
111
+ name: Events.InteractionCreate,
112
+ once: false
113
+ },
114
+ async execute(client: StelliaClient<true>, interaction: Interaction) {
115
+ if (interaction.inCachedGuild()) {
116
+ await client.handleInteraction(interaction); // Automatic interaction handling
117
+ }
118
+ }
119
+ } as EventStructure;
120
+ ```
121
+
70
122
  ### Simple command
71
123
 
72
124
  ```js
@@ -3,7 +3,7 @@ import { readdirSync, statSync } from "fs";
3
3
  import path from "path";
4
4
  export const requiredFiles = async (directoryPath) => {
5
5
  const collection = new Collection();
6
- const filesPath = getAllFilesPath(directoryPath).filter((file) => file.endsWith(".ts"));
6
+ const filesPath = getAllFilesPath(directoryPath).filter((file) => !file.endsWith(".d.ts") && (file.endsWith(".js") || file.endsWith(".ts")));
7
7
  for (const filePath of filesPath) {
8
8
  const data = await loadInteraction(filePath);
9
9
  collection.set(data.data.name, data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stelliajs/framework",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {