@stelliajs/framework 1.0.2 → 1.0.3
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 +88 -0
- package/package.json +1 -1
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.
|