@stelliajs/framework 1.0.2 → 1.0.4

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 ADDED
@@ -0,0 +1,88 @@
1
+ # StelliaJS
2
+
3
+ ## About
4
+
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
+ A CLI is currently being developed and will soon be available for even greater convenience.
7
+
8
+ ## Examples
9
+
10
+ ### Simple client
11
+
12
+ ```js
13
+ import { StelliaClient } from "@stelliajs/framework";
14
+ import { GatewayIntentBits } from "discord-api-types/v10";
15
+ import { Partials } from "discord.js";
16
+
17
+ const client = new StelliaClient({
18
+ intents: [
19
+ GatewayIntentBits.Guilds,
20
+ GatewayIntentBits.GuildMessages,
21
+ GatewayIntentBits.MessageContent,
22
+ GatewayIntentBits.GuildMembers
23
+ ],
24
+ partials: [Partials.Message, Partials.GuildMember]
25
+ }, {
26
+ autoCompletes: {
27
+ directoryPath: "./src/interactions/autoCompletes"
28
+ },
29
+ buttons: {
30
+ directoryPath: "./src/interactions/buttons"
31
+ },
32
+ commands: {
33
+ directoryPath: "./src/commands/slash"
34
+ },
35
+ contextMenus: {
36
+ directoryPath: "./src/commands/contextMenus"
37
+ },
38
+ events: {
39
+ directoryPath: "./src/events"
40
+ },
41
+ modals: {
42
+ directoryPath: "./src/interactions/modals"
43
+ },
44
+ selectMenus: {
45
+ directoryPath: "./src/interactions/selectMenus"
46
+ }
47
+ });
48
+
49
+ await client.connect(process.env.TOKEN);
50
+ ```
51
+
52
+ ### Simple event
53
+
54
+ ```js
55
+ import { type StelliaClient, type EventStructure } from "@stelliajs/framework";
56
+ import { Events } from "discord.js";
57
+
58
+ export default {
59
+ data: {
60
+ name: Events.ClientReady,
61
+ once: true
62
+ },
63
+ async execute(client: StelliaClient<true>) { // <true> ensures that the client is Ready
64
+ console.log(`Logged in as ${client.user.tag}`);
65
+ await client.initializeCommands(); // Used to initialise registered commands
66
+ }
67
+ } as EventStructure;
68
+ ```
69
+
70
+ ### Simple command
71
+
72
+ ```js
73
+ import { type CommandStructure, type StelliaClient } from "@stelliajs/framework";
74
+ import { type ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
75
+
76
+ export default {
77
+ data: new SlashCommandBuilder()
78
+ .setName("ping"),
79
+ async execute(client: StelliaClient, interaction: ChatInputCommandInteraction<"cached">) { // All interactions are cached
80
+ await interaction.reply("Pong!");
81
+ }
82
+ } as CommandStructure;
83
+ ```
84
+
85
+
86
+ ## Help
87
+
88
+ If you need help with the framework you can open an issue.
@@ -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) => /\.(js|[^d]\.ts)$/.test(file));
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.2",
3
+ "version": "1.0.4",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {