@guardbot/framework 1.1.2 → 2.0.0
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 +29 -26
- package/build/{index.mjs → index.cjs} +451 -334
- package/build/index.cjs.map +1 -0
- package/build/{index.d.mts → index.d.cts} +149 -97
- package/build/index.d.ts +149 -97
- package/build/index.js +420 -371
- package/build/index.js.map +1 -0
- package/package.json +29 -21
package/README.md
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
# @guardbot/framework
|
|
2
|
+
> **A simple framework made for building discord bots with discord.js.**
|
|
2
3
|
|
|
3
|
-
<
|
|
4
|
-
<p align="center">
|
|
4
|
+
<div>
|
|
5
5
|
<img src="https://raw.githubusercontent.com/guardbotgg/assets/master/made-with-typescript.svg" alt="badge" />
|
|
6
6
|
<img src="https://raw.githubusercontent.com/guardbotgg/assets/master/made-with-love.svg" alt="badge" />
|
|
7
|
-
</
|
|
8
|
-
<br/>
|
|
7
|
+
</div >
|
|
9
8
|
|
|
10
|
-
# @guardbot/framework
|
|
11
|
-
> **A simple framework made for building discord bots with discord.js.**
|
|
12
9
|
|
|
13
|
-
##
|
|
14
|
-
```
|
|
10
|
+
## 📦 Installation
|
|
11
|
+
```bash
|
|
15
12
|
$ npm install @guardbot/framework # via npm
|
|
16
|
-
$ yarn add @guardbot/framework
|
|
17
|
-
$ pnpm add @guardbot/framework
|
|
13
|
+
$ yarn add @guardbot/framework # via yarn
|
|
14
|
+
$ pnpm add @guardbot/framework # via pnpm
|
|
18
15
|
```
|
|
19
16
|
|
|
20
|
-
##
|
|
21
|
-
- Easy to use.
|
|
22
|
-
- Beginner friendly.
|
|
23
|
-
- Supports Intellisense.
|
|
24
|
-
|
|
25
|
-
## **🪴 Quick Start**
|
|
17
|
+
## 🪴 Getting Started
|
|
26
18
|
|
|
27
19
|
### 1. Initialize the Client
|
|
28
20
|
Create your main entry file (e.g., `index.ts`) and initialize the `FrameworkClient`.
|
|
29
|
-
|
|
30
21
|
```typescript
|
|
31
22
|
import { FrameworkClient } from '@guardbot/framework';
|
|
32
23
|
import { GatewayIntentBits } from 'discord.js';
|
|
@@ -40,9 +31,10 @@ const client = new FrameworkClient({
|
|
|
40
31
|
GatewayIntentBits.MessageContent
|
|
41
32
|
]
|
|
42
33
|
},
|
|
34
|
+
prefix: '!',
|
|
43
35
|
rootDir: path.join(__dirname),
|
|
44
36
|
registerOnStart: true,
|
|
45
|
-
|
|
37
|
+
guildsToRegister: [],
|
|
46
38
|
});
|
|
47
39
|
|
|
48
40
|
client.login('DISCORD_BOT_TOKEN');
|
|
@@ -50,7 +42,6 @@ client.login('DISCORD_BOT_TOKEN');
|
|
|
50
42
|
|
|
51
43
|
### 2. Create a Slash Command
|
|
52
44
|
Create a file in your commands directory (e.g., `src/commands/general/ping.ts`).
|
|
53
|
-
|
|
54
45
|
```typescript
|
|
55
46
|
import { SlashCommand } from '@guardbot/framework';
|
|
56
47
|
|
|
@@ -67,8 +58,7 @@ export default SlashCommand({
|
|
|
67
58
|
```
|
|
68
59
|
|
|
69
60
|
### 3. Create a Message Command
|
|
70
|
-
Create a file for prefix-based commands (e.g., `src/commands/
|
|
71
|
-
|
|
61
|
+
Create a file for prefix-based commands (e.g., `src/commands/legacy/ping.ts`).
|
|
72
62
|
```typescript
|
|
73
63
|
import { MessageCommand } from '@guardbot/framework';
|
|
74
64
|
|
|
@@ -86,7 +76,6 @@ export default MessageCommand({
|
|
|
86
76
|
|
|
87
77
|
### 4. Create an Event Listener
|
|
88
78
|
Create an event file (e.g., `src/listeners/client/ready.ts`).
|
|
89
|
-
|
|
90
79
|
```typescript
|
|
91
80
|
import { Listener } from '@guardbot/framework';
|
|
92
81
|
|
|
@@ -97,10 +86,24 @@ export default Listener({
|
|
|
97
86
|
async execute(client) {
|
|
98
87
|
console.log(`Logged in as ${client.user.tag}!`);
|
|
99
88
|
console.log(`Loaded ${client.commands.size} commands.`);
|
|
100
|
-
return true;
|
|
101
89
|
}
|
|
102
90
|
})
|
|
103
91
|
```
|
|
104
92
|
|
|
105
|
-
|
|
106
|
-
|
|
93
|
+
### 5. Recommended Project Structure
|
|
94
|
+
```bash
|
|
95
|
+
src/
|
|
96
|
+
├─ commands/
|
|
97
|
+
│ └─ general/
|
|
98
|
+
│ └─ ping.ts
|
|
99
|
+
├─ listeners/
|
|
100
|
+
│ └─ client/
|
|
101
|
+
│ └─ ready.ts
|
|
102
|
+
└─ index.ts
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 🪴 Support Server
|
|
107
|
+
<a href="https://discord.gg/invite/GaczkwfgV9" target="_blank">
|
|
108
|
+
<img src="https://discordwidgets.vercel.app/widgets/invite/GaczkwfgV9?theme=dark" alt="Invite" />
|
|
109
|
+
</a>
|