djs-builder 0.5.42 → 0.6.1
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 +161 -339
- package/function/function.js +236 -0
- package/function/log.js +736 -0
- package/handler/helper.js +277 -0
- package/handler/starter.js +335 -0
- package/package.json +10 -42
- package/.tsbuildinfo +0 -1
- package/dist/discord/builder/components/Buttons.d.ts +0 -22
- package/dist/discord/builder/components/Buttons.d.ts.map +0 -1
- package/dist/discord/builder/components/Buttons.js +0 -91
- package/dist/discord/builder/components/Buttons.js.map +0 -1
- package/dist/discord/builder/components/Menus.d.ts +0 -31
- package/dist/discord/builder/components/Menus.d.ts.map +0 -1
- package/dist/discord/builder/components/Menus.js +0 -82
- package/dist/discord/builder/components/Menus.js.map +0 -1
- package/dist/discord/builder/permissions/perms.d.ts +0 -6
- package/dist/discord/builder/permissions/perms.d.ts.map +0 -1
- package/dist/discord/builder/permissions/perms.js +0 -66
- package/dist/discord/builder/permissions/perms.js.map +0 -1
- package/dist/discord/builder/system/Pagination.d.ts +0 -68
- package/dist/discord/builder/system/Pagination.d.ts.map +0 -1
- package/dist/discord/builder/system/Pagination.js +0 -256
- package/dist/discord/builder/system/Pagination.js.map +0 -1
- package/dist/discord/builder/system/collectors.d.ts +0 -27
- package/dist/discord/builder/system/collectors.d.ts.map +0 -1
- package/dist/discord/builder/system/collectors.js +0 -137
- package/dist/discord/builder/system/collectors.js.map +0 -1
- package/dist/discord/builder/utils.d.ts +0 -5
- package/dist/discord/builder/utils.d.ts.map +0 -1
- package/dist/discord/builder/utils.js +0 -10
- package/dist/discord/builder/utils.js.map +0 -1
- package/dist/discord/events-handler/eventLoader.d.ts +0 -13
- package/dist/discord/events-handler/eventLoader.d.ts.map +0 -1
- package/dist/discord/events-handler/eventLoader.js +0 -169
- package/dist/discord/events-handler/eventLoader.js.map +0 -1
- package/dist/discord/events-handler/events.d.ts +0 -8
- package/dist/discord/events-handler/events.d.ts.map +0 -1
- package/dist/discord/events-handler/events.js +0 -186
- package/dist/discord/events-handler/events.js.map +0 -1
- package/dist/discord/events-handler/login.d.ts +0 -9
- package/dist/discord/events-handler/login.d.ts.map +0 -1
- package/dist/discord/events-handler/login.js +0 -273
- package/dist/discord/events-handler/login.js.map +0 -1
- package/dist/discord/events-handler/prefix-register.d.ts +0 -23
- package/dist/discord/events-handler/prefix-register.d.ts.map +0 -1
- package/dist/discord/events-handler/prefix-register.js +0 -109
- package/dist/discord/events-handler/prefix-register.js.map +0 -1
- package/dist/discord/events-handler/prefix-responder.d.ts +0 -5
- package/dist/discord/events-handler/prefix-responder.d.ts.map +0 -1
- package/dist/discord/events-handler/prefix-responder.js +0 -155
- package/dist/discord/events-handler/prefix-responder.js.map +0 -1
- package/dist/discord/events-handler/prefixLoader.d.ts +0 -7
- package/dist/discord/events-handler/prefixLoader.d.ts.map +0 -1
- package/dist/discord/events-handler/prefixLoader.js +0 -74
- package/dist/discord/events-handler/prefixLoader.js.map +0 -1
- package/dist/discord/events-handler/slash-register.d.ts +0 -4
- package/dist/discord/events-handler/slash-register.d.ts.map +0 -1
- package/dist/discord/events-handler/slash-register.js +0 -85
- package/dist/discord/events-handler/slash-register.js.map +0 -1
- package/dist/discord/events-handler/slash-responder.d.ts +0 -3
- package/dist/discord/events-handler/slash-responder.d.ts.map +0 -1
- package/dist/discord/events-handler/slash-responder.js +0 -112
- package/dist/discord/events-handler/slash-responder.js.map +0 -1
- package/dist/discord/events-handler/slashLoader.d.ts +0 -7
- package/dist/discord/events-handler/slashLoader.d.ts.map +0 -1
- package/dist/discord/events-handler/slashLoader.js +0 -94
- package/dist/discord/events-handler/slashLoader.js.map +0 -1
- package/dist/discord/events-handler/starter.d.ts +0 -6
- package/dist/discord/events-handler/starter.d.ts.map +0 -1
- package/dist/discord/events-handler/starter.js +0 -85
- package/dist/discord/events-handler/starter.js.map +0 -1
- package/dist/discord/functions/anticrash.d.ts +0 -3
- package/dist/discord/functions/anticrash.d.ts.map +0 -1
- package/dist/discord/functions/anticrash.js +0 -55
- package/dist/discord/functions/anticrash.js.map +0 -1
- package/dist/discord/functions/devLogs.d.ts +0 -2
- package/dist/discord/functions/devLogs.d.ts.map +0 -1
- package/dist/discord/functions/devLogs.js +0 -137
- package/dist/discord/functions/devLogs.js.map +0 -1
- package/dist/discord/functions/logger.d.ts +0 -5
- package/dist/discord/functions/logger.d.ts.map +0 -1
- package/dist/discord/functions/logger.js +0 -57
- package/dist/discord/functions/logger.js.map +0 -1
- package/dist/discord/functions/mongoDb.d.ts +0 -4
- package/dist/discord/functions/mongoDb.d.ts.map +0 -1
- package/dist/discord/functions/mongoDb.js +0 -39
- package/dist/discord/functions/mongoDb.js.map +0 -1
- package/dist/discord/functions/similarity.d.ts +0 -3
- package/dist/discord/functions/similarity.d.ts.map +0 -1
- package/dist/discord/functions/similarity.js +0 -56
- package/dist/discord/functions/similarity.js.map +0 -1
- package/dist/discord/functions/terminal.d.ts +0 -2
- package/dist/discord/functions/terminal.d.ts.map +0 -1
- package/dist/discord/functions/terminal.js +0 -127
- package/dist/discord/functions/terminal.js.map +0 -1
- package/dist/discord/functions/utils.d.ts +0 -5
- package/dist/discord/functions/utils.d.ts.map +0 -1
- package/dist/discord/functions/utils.js +0 -11
- package/dist/discord/functions/utils.js.map +0 -1
- package/dist/discord/functions/versedb.d.ts +0 -3
- package/dist/discord/functions/versedb.d.ts.map +0 -1
- package/dist/discord/functions/versedb.js +0 -21
- package/dist/discord/functions/versedb.js.map +0 -1
- package/dist/discord/games/X-O.d.ts +0 -20
- package/dist/discord/games/X-O.d.ts.map +0 -1
- package/dist/discord/games/X-O.js +0 -166
- package/dist/discord/games/X-O.js.map +0 -1
- package/dist/discord/games/rps.d.ts +0 -21
- package/dist/discord/games/rps.d.ts.map +0 -1
- package/dist/discord/games/rps.js +0 -99
- package/dist/discord/games/rps.js.map +0 -1
- package/dist/discord/types/starter.d.ts +0 -144
- package/dist/discord/types/starter.d.ts.map +0 -1
- package/dist/discord/types/starter.js +0 -3
- package/dist/discord/types/starter.js.map +0 -1
- package/dist/discord/types/utils.d.ts +0 -3
- package/dist/discord/types/utils.d.ts.map +0 -1
- package/dist/discord/types/utils.js +0 -3
- package/dist/discord/types/utils.js.map +0 -1
- package/dist/discord/utils.d.ts +0 -15
- package/dist/discord/utils.d.ts.map +0 -1
- package/dist/discord/utils.js +0 -41
- package/dist/discord/utils.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -71
- package/dist/index.js.map +0 -1
- package/lib/discord/builder/components/Buttons.ts +0 -123
- package/lib/discord/builder/components/Menus.ts +0 -106
- package/lib/discord/builder/permissions/perms.ts +0 -66
- package/lib/discord/builder/system/Pagination.ts +0 -374
- package/lib/discord/builder/system/collectors.ts +0 -197
- package/lib/discord/builder/utils.ts +0 -9
- package/lib/discord/events-handler/eventLoader.ts +0 -166
- package/lib/discord/events-handler/events.ts +0 -160
- package/lib/discord/events-handler/login.ts +0 -265
- package/lib/discord/events-handler/prefix-register.ts +0 -117
- package/lib/discord/events-handler/prefix-responder.ts +0 -176
- package/lib/discord/events-handler/prefixLoader.ts +0 -83
- package/lib/discord/events-handler/slash-register.ts +0 -81
- package/lib/discord/events-handler/slash-responder.ts +0 -136
- package/lib/discord/events-handler/slashLoader.ts +0 -104
- package/lib/discord/events-handler/starter.ts +0 -85
- package/lib/discord/functions/anticrash.ts +0 -60
- package/lib/discord/functions/devLogs.ts +0 -128
- package/lib/discord/functions/logger.ts +0 -58
- package/lib/discord/functions/mongoDb.ts +0 -38
- package/lib/discord/functions/similarity.ts +0 -70
- package/lib/discord/functions/terminal.ts +0 -162
- package/lib/discord/functions/utils.ts +0 -4
- package/lib/discord/functions/versedb.ts +0 -17
- package/lib/discord/types/starter.ts +0 -158
- package/lib/discord/types/utils.ts +0 -2
- package/lib/discord/utils.ts +0 -17
- package/lib/index.ts +0 -37
- package/tsconfig.json +0 -21
package/README.md
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
3
|
## [](#)
|
|
4
|
+
|
|
4
5
|
**Welcome to the Discord Bot Utilities package! 🥏**
|
|
5
|
-
**This package provides a set of utility classes/interfaces to simplify 🎍**
|
|
6
|
-
**common tasks when developing Discord bots using the Discord.js library ✨.**
|
|
7
6
|
|
|
8
7
|
## Table of Contents
|
|
9
8
|
|
|
10
|
-
1. [Starter](#
|
|
11
|
-
2. [
|
|
12
|
-
3. [
|
|
13
|
-
4. [PermissionChecker](#Easyest)
|
|
14
|
-
5. [Options](#options)
|
|
9
|
+
1. [Starter](#Easiest)
|
|
10
|
+
2. [Function](#Easiest)
|
|
11
|
+
3. [Command](#Easiest)
|
|
15
12
|
|
|
16
|
-
##
|
|
13
|
+
## 🎯 STARTER
|
|
17
14
|
|
|
18
15
|
Starter provides functionality for initializing and starting a Discord bot 🤖.
|
|
19
16
|
|
|
@@ -26,402 +23,228 @@ Starter provides functionality for initializing and starting a Discord bot 🤖.
|
|
|
26
23
|
- **🔋 Direct connection with MongoDB 📥**
|
|
27
24
|
- **📑 Logging for slash and prefix command usage with comprehensive information 🧭**
|
|
28
25
|
|
|
29
|
-
>
|
|
26
|
+
> 💡 **Tip:** Any option you don't want, just `DELETE 🗑️` the option .
|
|
30
27
|
|
|
31
28
|
<details>
|
|
32
|
-
<summary>
|
|
33
|
-
|
|
34
|
-
```js
|
|
35
|
-
const { Starter } = require('djs-builder'); // cjs module .js
|
|
36
|
-
|
|
37
|
-
const { Client, GatewayIntentBits, Partials } = require('discord.js');
|
|
38
|
-
const client = new Client({
|
|
39
|
-
intents: Object.keys(GatewayIntentBits).map((a) => {
|
|
40
|
-
return GatewayIntentBits[a];
|
|
41
|
-
}),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Define starter options
|
|
45
|
-
const starterOptions = {
|
|
46
|
-
bot: {
|
|
47
|
-
token: 'YOUR_BOT_TOKEN', // [OPTIONAL] Discord bot token
|
|
48
|
-
logs: {
|
|
49
|
-
terminal: true // [OPTIONAL] Log messages to terminal
|
|
50
|
-
},
|
|
51
|
-
Status: {
|
|
52
|
-
state: 'online', // Required: Bot presence state ['online', 'offline', 'dnd', 'idle', 'Streaming']
|
|
53
|
-
activities: ['Game 1', 'Game 2'], // [OPTIONAL] Bot activities
|
|
54
|
-
type: 0, // [OPTIONAL] Bot activity type
|
|
55
|
-
delay: 60000 // [OPTIONAL] Activity rotation delay in milliseconds
|
|
56
|
-
},
|
|
57
|
-
Database: {
|
|
58
|
-
mongo: {
|
|
59
|
-
mongoURI: 'mongodb://localhost:27017', // Required: MongoDB connection URI
|
|
60
|
-
dbName: 'your_database_name' // [OPTIONAL] MongoDB database name
|
|
61
|
-
},
|
|
62
|
-
verse: {
|
|
63
|
-
adapterType: 'json', // Required: Database adapter type ['json', 'yaml', 'sql']
|
|
64
|
-
path: '/database/folder', // Required: Path to database folder [Note: "Not path to file!"]
|
|
65
|
-
dev: {
|
|
66
|
-
enable: true, // Required: Enable development mode
|
|
67
|
-
logsPath: '/path/to/logs' // [OPTIONAL] Path to development logs [Note: "It will create logs file for database executions logs!"]
|
|
68
|
-
},
|
|
69
|
-
secure: { enable: false, secret:'your_encryption_key'} // [OPTIONAL] To secure Data File by encrypting it with secret key
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
slash: {
|
|
74
|
-
path: './path/to/slash_commands', // Required: Path to slash commands
|
|
75
|
-
global: true, // [OPTIONAL] Register slash commands globally
|
|
76
|
-
serverId: '123456789012345678', // [OPTIONAL] Discord server ID
|
|
77
|
-
logsId: '123456789012345678' // [OPTIONAL] Logs channel ID
|
|
78
|
-
},
|
|
79
|
-
prefix: {
|
|
80
|
-
path: './path/to/prefixes', // Required: Path to prefix settings
|
|
81
|
-
prefix: '!', // Required: Default bot prefix
|
|
82
|
-
global: true, // [OPTIONAL] Use global prefix
|
|
83
|
-
serverIds: ['123456789012345678'], // [OPTIONAL] Discord server IDs
|
|
84
|
-
logsId: '123456789012345678' // [OPTIONAL] Logs channel ID
|
|
85
|
-
},
|
|
86
|
-
events: {
|
|
87
|
-
path: './path/to/events', // Required: Path to event handlers
|
|
88
|
-
recursive: true, // [OPTIONAL] Enable recursive event loading
|
|
89
|
-
eventBlacklist: ['path/to the event/file.js', 'path/to the event/file.js'] // [OPTIONAL] Blacklisted events
|
|
90
|
-
},
|
|
91
|
-
anticrash: {
|
|
92
|
-
enable: true, // Required: Enable anti-crash feature
|
|
93
|
-
webhookURL: 'https://your.crash.webhook.url', // Required: Webhook URL for crash alerts
|
|
94
|
-
mention: '<@123456789012345678>' // [OPTIONAL] User ID to mention in crash alerts
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const bot = new Starter();
|
|
99
|
-
bot.start(client, starterOptions);
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
</details>
|
|
103
|
-
|
|
104
|
-
<details>
|
|
105
|
-
<summary>ALL Options ⚙️</summary>
|
|
106
|
-
|
|
107
|
-
```js
|
|
108
|
-
const { Starter } = require('djs-builder'); // cjs module .js
|
|
109
|
-
|
|
110
|
-
const { Client, GatewayIntentBits, Partials } = require('discord.js');
|
|
111
|
-
const client = new Client({
|
|
112
|
-
intents: Object.keys(GatewayIntentBits).map((a) => {
|
|
113
|
-
return GatewayIntentBits[a];
|
|
114
|
-
}),
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// OR
|
|
118
|
-
import { Starter } from 'djs-builder'; // Ejs module .mjs or Ts
|
|
119
|
-
|
|
120
|
-
import { Client, GatewayIntentBits, Partials, PermissionFlagsBits } from 'discord.js';
|
|
121
|
-
|
|
122
|
-
const intentsArray = Object.keys(GatewayIntentBits)
|
|
123
|
-
.map((a) => GatewayIntentBits[a as keyof typeof GatewayIntentBits]);
|
|
124
|
-
const intents = intentsArray.reduce((acc, curr) => acc | curr, 0);
|
|
125
|
-
|
|
126
|
-
const client = new Client({
|
|
127
|
-
intents,
|
|
128
|
-
partials: Object.values(Partials) as Partials[],
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Define starter options
|
|
132
|
-
const starterOptions = {
|
|
133
|
-
bot: {
|
|
134
|
-
|
|
135
|
-
token: 'YOUR_BOT_TOKEN', // [OPTIONAL] Discord bot token
|
|
136
|
-
logs: {
|
|
137
|
-
devLogs: {
|
|
138
|
-
enable: true, // Required: Enable developer logs
|
|
139
|
-
pathToWatch: '/path/to/watch', // Required: Path to watch for file changes
|
|
140
|
-
webhookURL: 'https://your.webhook.url', // Required: Webhook URL for logging
|
|
141
|
-
mention: '<@123456789012345678>' // [OPTIONAL] User ID to mention in logs
|
|
142
|
-
},
|
|
143
|
-
terminal: true // [OPTIONAL] Log messages to terminal
|
|
144
|
-
},
|
|
145
|
-
name: 'Your Bot Name', // [OPTIONAL] Bot name
|
|
146
|
-
avatar: 'https://your.bot/avatar.png', // [OPTIONAL] Bot avatar URL or local path image
|
|
147
|
-
banner: 'https://your.bot/banner.png', // [OPTIONAL] Bot banner URL or local path image
|
|
148
|
-
BotInfo: {
|
|
149
|
-
perms: ['SendMessages', 'BotMessages'], // [OPTIONAL] Bot permissions to work in any server
|
|
150
|
-
serverId: '123456789012345678', // [OPTIONAL] Discord server ID
|
|
151
|
-
botInvite: 'https://discord.com/invite/your-bot-invite', // [OPTIONAL] Bot invite URL
|
|
152
|
-
serverInvite: 'https://discord.com/invite/your-server-invite', // [OPTIONAL] Server invite URL
|
|
153
|
-
ownerId: '123456789012345678', // [OPTIONAL] Bot owner's user ID
|
|
154
|
-
partners: ['partner1', 'partner2'] // [OPTIONAL] Bot partners
|
|
155
|
-
},
|
|
156
|
-
Status: {
|
|
157
|
-
state: 'online', // Required: Bot presence state ['online', 'offline', 'dnd', 'idle', 'Streaming']
|
|
158
|
-
activities: ['Game 1', 'Game 2'], // [OPTIONAL] Bot activities
|
|
159
|
-
type: 0, // [OPTIONAL] Bot activity type
|
|
160
|
-
delay: 60000 // [OPTIONAL] Activity rotation delay in milliseconds
|
|
161
|
-
},
|
|
162
|
-
Database: {
|
|
163
|
-
mongo: {
|
|
164
|
-
mongoURI: 'mongodb://localhost:27017', // Required: MongoDB connection URI
|
|
165
|
-
dbName: 'your_database_name' // [OPTIONAL] MongoDB database name
|
|
166
|
-
},
|
|
167
|
-
verse: {
|
|
168
|
-
adapterType: 'json', // Required: Database adapter type ['json', 'yaml', 'sql']
|
|
169
|
-
path: '/database/folder', // Required: Path to database folder [Note: "Not path to file!"]
|
|
170
|
-
dev: {
|
|
171
|
-
enable: true, // Required: Enable development mode
|
|
172
|
-
logsPath: '/path/to/logs' // [OPTIONAL] Path to development logs [Note: "It will create logs file for database executions logs!"]
|
|
173
|
-
},
|
|
174
|
-
secure: { enable: false, secret:'your_encryption_key'} // [OPTIONAL] To secure Data File by encrypting it with secret key
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
slash: {
|
|
179
|
-
path: './path/to/slash_commands', // Required: Path to slash commands
|
|
180
|
-
global: true, // [OPTIONAL] Register slash commands globally
|
|
181
|
-
serverId: '123456789012345678', // [OPTIONAL] Discord server ID
|
|
182
|
-
logsId: '123456789012345678' // [OPTIONAL] Logs channel ID
|
|
183
|
-
},
|
|
184
|
-
prefix: {
|
|
185
|
-
path: './path/to/prefixes', // Required: Path to prefix settings
|
|
186
|
-
prefix: '!', // Required: Default bot prefix
|
|
187
|
-
global: true, // [OPTIONAL] Use global prefix
|
|
188
|
-
serverIds: ['123456789012345678'], // [OPTIONAL] Discord server IDs
|
|
189
|
-
logsId: '123456789012345678' // [OPTIONAL] Logs channel ID
|
|
190
|
-
},
|
|
191
|
-
events: {
|
|
192
|
-
path: './path/to/events', // Required: Path to event handlers
|
|
193
|
-
recursive: true, // [OPTIONAL] Enable recursive event loading
|
|
194
|
-
eventBlacklist: ['path/to the event/file.js', 'path/to the event/file.js'] // [OPTIONAL] Blacklisted events
|
|
195
|
-
},
|
|
196
|
-
anticrash: {
|
|
197
|
-
enable: true, // Required: Enable anti-crash feature
|
|
198
|
-
webhookURL: 'https://your.crash.webhook.url', // Required: Webhook URL for crash alerts
|
|
199
|
-
mention: '<@123456789012345678>' // [OPTIONAL] User ID to mention in crash alerts
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// Define the starter instance
|
|
204
|
-
const bot = new Starter();
|
|
205
|
-
|
|
206
|
-
async function botStart() {
|
|
207
|
-
const botstarted = await bot.start(client, starterOptions);
|
|
208
|
-
const mongodb = await botstarted.mongodb;
|
|
209
|
-
const versedb = await botstarted.versedb;
|
|
210
|
-
const slashSize = await botstarted.slashSize;
|
|
211
|
-
const prefixSize = await botstarted.prefixSize;
|
|
212
|
-
const eventSize = await botstarted.eventSize;
|
|
213
|
-
return {
|
|
214
|
-
getDb: mongodb,
|
|
215
|
-
db: versedb,
|
|
216
|
-
slashSize: slashSize,
|
|
217
|
-
prefixSize: prefixSize,
|
|
218
|
-
eventSize: eventSize
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
module.exports = { botStart };
|
|
222
|
-
// Or
|
|
223
|
-
export { botStart };
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
- **Usage for the returned values from botStart() funtion**:
|
|
29
|
+
<summary>Starter ⚙️</summary>
|
|
227
30
|
|
|
228
31
|
```js
|
|
229
|
-
const {
|
|
230
|
-
// Or
|
|
231
|
-
import { botStart } from 'path/to/file/where botStart is exported from';
|
|
32
|
+
const { starter } = require("djs-builder");
|
|
232
33
|
|
|
233
|
-
|
|
234
|
-
|
|
34
|
+
const { Client, GatewayIntentBits } = require("discord.js");
|
|
35
|
+
const client = new Client({
|
|
36
|
+
intents: Object.keys(GatewayIntentBits).map((a) => {
|
|
37
|
+
return GatewayIntentBits[a];
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
235
40
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
41
|
+
// Define starter options
|
|
42
|
+
const starterOptions = {
|
|
43
|
+
bot: {
|
|
44
|
+
token: "YOUR_BOT_TOKEN", // [OPTIONAL] Discord bot token
|
|
45
|
+
ownerId: "YOUR_USER_ID",
|
|
46
|
+
},
|
|
47
|
+
terminal: true,
|
|
48
|
+
Status: {
|
|
49
|
+
status: "online", // Required: Bot presence state ['online', 'offline', 'dnd', 'idle', 'Streaming']
|
|
50
|
+
activities: ["Game 1", "Game 2"], // [OPTIONAL] Bot activities
|
|
51
|
+
type: 0, // [OPTIONAL] Bot activity type
|
|
52
|
+
time: 60000, // [OPTIONAL] Activity rotation delay in milliseconds
|
|
53
|
+
},
|
|
54
|
+
database: {
|
|
55
|
+
url: "mongodb://localhost:27017", // Required: MongoDB connection URI
|
|
56
|
+
},
|
|
239
57
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
58
|
+
slash: {
|
|
59
|
+
path: "./path/to/slash_commands", // Required: Path to slash commands
|
|
60
|
+
log: "", // id of log channel
|
|
61
|
+
},
|
|
62
|
+
prefix: {
|
|
63
|
+
path: "./path/to/prefixes", // Required: Path to prefix settings
|
|
64
|
+
prefix: "!", // Required: Default bot prefix
|
|
65
|
+
log: "", // id of log channel
|
|
66
|
+
},
|
|
67
|
+
events: {
|
|
68
|
+
path: "./path/to/events", // Required: Path to event handlers
|
|
69
|
+
},
|
|
70
|
+
anticrash: {
|
|
71
|
+
url: "https://your.crash.webhook.url", // Required: Webhook URL for crash alerts
|
|
72
|
+
mention_id: "YOUR_USER_ID", // [OPTIONAL] User ID to mention in crash alerts
|
|
73
|
+
},
|
|
74
|
+
};
|
|
243
75
|
|
|
244
|
-
|
|
245
|
-
console.log(`loaded slash Commands: ${client.slashSize}`);
|
|
246
|
-
console.log(`loaded prefix Commands: ${client.prefixSize}`);
|
|
247
|
-
console.log(`loaded events: ${client.eventSize}`);
|
|
248
|
-
}
|
|
76
|
+
await starter(client, starterOptions);
|
|
249
77
|
|
|
250
|
-
test()
|
|
251
78
|
```
|
|
79
|
+
|
|
252
80
|
</details>
|
|
253
81
|
|
|
254
|
-
##
|
|
82
|
+
## ⚙️ function
|
|
255
83
|
|
|
256
|
-
**Build 🔵Button , 🧾Menu or 🏅PermissionChecker**
|
|
257
84
|
- **Easyest ✨**
|
|
258
85
|
- **Fastest ⚡**
|
|
259
86
|
- **Clear 🧵**
|
|
260
87
|
|
|
261
88
|
**Than the discord.js**
|
|
262
89
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
90
|
<details>
|
|
268
|
-
<summary
|
|
269
|
-
|
|
91
|
+
<summary>CreateRow 🔵</summary>
|
|
270
92
|
|
|
93
|
+
**🔵 CreateRow is a utility for managing the creation of Discord Row ✨.**
|
|
271
94
|
|
|
272
|
-
|
|
95
|
+
```js
|
|
96
|
+
const { CreateRow } = require('djs-builder');
|
|
273
97
|
|
|
274
|
-
|
|
275
|
-
const { ButtonManager } = require('djs-builder'); // Cjs module .js
|
|
276
|
-
// OR
|
|
277
|
-
import { ButtonManager } from 'djs-builder'; // Ejs module .mjs or Ts
|
|
98
|
+
const actionRow = new CreateRow([
|
|
278
99
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
100
|
+
//// for any row add new [] or {}
|
|
101
|
+
// for buttom
|
|
102
|
+
[
|
|
103
|
+
{
|
|
104
|
+
id: 'button1', // ID for the button customId
|
|
105
|
+
style: 1, // style: Primary(1), Secondary(2), Success(3), Danger(4), Link(5)
|
|
284
106
|
label: 'Primary Button',
|
|
285
107
|
emoji: '😃', // Emoji for the button
|
|
286
|
-
|
|
108
|
+
enabled: false, // Whether the button is disabled
|
|
287
109
|
},
|
|
288
110
|
{
|
|
289
|
-
|
|
290
|
-
style:
|
|
291
|
-
label: 'Secondary Button',
|
|
111
|
+
id: 'button2',
|
|
112
|
+
style: 2,
|
|
292
113
|
emoji: '🚀',
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
//
|
|
304
|
-
|
|
114
|
+
enabled: true,
|
|
115
|
+
}
|
|
116
|
+
], ///// now it is row 1 for button and you can add more rows
|
|
117
|
+
{
|
|
118
|
+
type : "string" /// you can select from ["role" , "user" , "channel" ]
|
|
119
|
+
options : {
|
|
120
|
+
id: "menu", // ID for the select menu customId
|
|
121
|
+
placeholder: "Select an option", // Placeholder text for the select menu
|
|
122
|
+
min: 1, // Minimum number of selected values
|
|
123
|
+
max: 2, // Maximum number of selected values
|
|
124
|
+
data: [ // you shuld add your options (it not work for role , user and channel)
|
|
125
|
+
{ name: 'Option 1', id: 'option1', about: 'Description for Option 1', icon: '🌟' },
|
|
126
|
+
{ name: 'Option 2', id: 'option2', about: 'Description for Option 2', icon: '🚀' },
|
|
127
|
+
{ name: 'Option 3', id: 'option3', about: 'Description for Option 3', icon: '🔗' },
|
|
128
|
+
], //// is should not look like this ,you selecit it in next step
|
|
129
|
+
value: "id", // here you can set the value of the selected option ( defult the value is will be index (0,1,2 .....) )
|
|
130
|
+
description: "about" // here you can set the description of the selected option ( defult the description not work )
|
|
131
|
+
label: "name" // here you can set the label of the selected option ( defult the label is (Option 1 , Option 2 , Option 3) )
|
|
132
|
+
emoji: "icon" // here you can set the emoji of the selected option ( defult the emoji not work )
|
|
305
133
|
|
|
306
|
-
|
|
307
|
-
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
]);
|
|
308
137
|
|
|
309
|
-
// Exmaple
|
|
310
|
-
const message = await interaction.channel.send({ content: 'Here are some buttons:', components: [row] });
|
|
311
|
-
// OR
|
|
312
|
-
const message = await message.channel.send({ content: 'Here are some buttons:', components: [row] });
|
|
313
138
|
```
|
|
139
|
+
|
|
314
140
|
</details>
|
|
315
141
|
|
|
142
|
+
<details>
|
|
143
|
+
<summary>CreateBar 🧾</summary>
|
|
316
144
|
|
|
145
|
+
**🧾 CreateBar it ✨.**
|
|
317
146
|
|
|
318
|
-
|
|
319
|
-
|
|
147
|
+
```js
|
|
148
|
+
const { CreateBar } = require("djs-builder");
|
|
149
|
+
|
|
150
|
+
const menu = new CreateBar(0, 100, {
|
|
151
|
+
lenth: 20,
|
|
152
|
+
fill: "✅",
|
|
153
|
+
empty: "❌",
|
|
154
|
+
partialChar: "⏳",
|
|
155
|
+
showPercent: true,
|
|
156
|
+
left: "[",
|
|
157
|
+
right: "]",
|
|
158
|
+
});
|
|
159
|
+
```
|
|
320
160
|
|
|
161
|
+
you can do any type of bar you want like
|
|
321
162
|
|
|
163
|
+
```js
|
|
164
|
+
createProgressBar(3.7, 5, {
|
|
165
|
+
filledChar: '🟦',
|
|
166
|
+
emptyChar: '⬛',
|
|
167
|
+
partialChar: '🟨',
|
|
168
|
+
leftEdge: '❰',
|
|
169
|
+
rightEdge: '❱',
|
|
170
|
+
precision: 1
|
|
171
|
+
});
|
|
172
|
+
// ❰🟦🟦🟦🟨⬛❱ 74.0%
|
|
322
173
|
|
|
323
|
-
**🧾 MenuManager facilitates the creation of select menus (dropdown menus) in Discord ✨.**
|
|
324
174
|
|
|
325
|
-
```typescript
|
|
326
|
-
const { MenuManager } = require('djs-builder'); // Cjs module .js
|
|
327
|
-
// OR
|
|
328
|
-
import { MenuManager } from 'djs-builder'; // Ejs module .mjs or ts
|
|
329
175
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
];
|
|
176
|
+
console.log(createProgressBar(7, 10, {
|
|
177
|
+
length: 20,
|
|
178
|
+
filledChar: '💚',
|
|
179
|
+
emptyChar: '🖤',
|
|
180
|
+
}));
|
|
336
181
|
|
|
337
|
-
// Create an instance of SelectMenuManager
|
|
338
|
-
const selectMenuManager = new MenuManager(
|
|
339
|
-
selectMenuOptions,
|
|
340
|
-
'customSelectMenuId', // Custom ID for the select menu
|
|
341
|
-
'Select an option', // Placeholder text for the select menu
|
|
342
|
-
1, // Minimum number of selected values
|
|
343
|
-
2, // Maximum number of selected values
|
|
344
|
-
false // Disabled state for meny (true or false)
|
|
345
|
-
);
|
|
346
182
|
|
|
347
|
-
// Create a select menu with the specified options
|
|
348
|
-
const selectMenuRow = selectMenuManager.createSelectMenu();
|
|
349
183
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
content: 'Please choose an option:',
|
|
353
|
-
components: [selectMenuRow],
|
|
354
|
-
});
|
|
184
|
+
[💚💚💚💚💚💚💚🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤] 70%
|
|
185
|
+
|
|
355
186
|
|
|
356
|
-
// Define a interaction with the select menu
|
|
357
|
-
interaction.reply({
|
|
358
|
-
content: 'Please choose an option:',
|
|
359
|
-
components: [selectMenuRow],
|
|
360
|
-
});
|
|
361
187
|
```
|
|
362
188
|
|
|
363
189
|
</details>
|
|
364
190
|
|
|
365
191
|
<details>
|
|
366
|
-
<summary
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
**PermissionChecker provides functionality for checking user permissions in a Discord guild ✨.**
|
|
192
|
+
<summary>Wait ⏰</summary>
|
|
371
193
|
|
|
372
|
-
|
|
373
|
-
const { PermissionChecker } = require('djs-builder'); // Cjs module .js
|
|
374
|
-
// OR
|
|
375
|
-
import { PermissionChecker } from 'djs-builder'; // Ejs module .mjs or ts
|
|
194
|
+
**⏰ Wait insted of collecter 🤮 ✨.**
|
|
376
195
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
// Interaction case
|
|
380
|
-
const userId = interaction.user.id;
|
|
381
|
-
const guild = interaction.guild;
|
|
382
|
-
// Message Case
|
|
383
|
-
const guild = message.guild;
|
|
384
|
-
const memberId = message.author.id;
|
|
385
|
-
|
|
386
|
-
// Usage:
|
|
196
|
+
```js
|
|
197
|
+
const { Wait } = require('djs-builder');
|
|
387
198
|
|
|
388
|
-
const
|
|
389
|
-
|
|
199
|
+
const message = await Wait({
|
|
200
|
+
context: message, /// message or interaction
|
|
201
|
+
userId : (message.author.id || interaction.user.id), /// user id
|
|
202
|
+
type: "button", /// message or button or both 💪
|
|
203
|
+
time: 30000 /// time in ms
|
|
204
|
+
message_Wait : message /// message of button (for button or both)
|
|
205
|
+
});
|
|
390
206
|
|
|
391
207
|
```
|
|
392
|
-
</details>
|
|
393
208
|
|
|
394
|
-
## Options:
|
|
395
|
-
|
|
396
|
-
- **Slash 🔧**
|
|
397
|
-
<details>
|
|
398
|
-
<summary>Options</summary>
|
|
399
|
-
|
|
400
|
-
- Cooldown ⏳
|
|
401
209
|
</details>
|
|
402
210
|
|
|
403
|
-
- **Prefix ➕**
|
|
404
211
|
<details>
|
|
405
|
-
<summary>
|
|
212
|
+
<summary>log 📸</summary>
|
|
406
213
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
214
|
+
**📸 Log For All Discord Events ✨.**
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
const { log } = require("djs-builder");
|
|
218
|
+
|
|
219
|
+
module.exports = {
|
|
220
|
+
name: "ready",
|
|
221
|
+
async run(client) {
|
|
222
|
+
await log(
|
|
223
|
+
client,
|
|
224
|
+
"YOUR_GUILD_ID", /// your guild id
|
|
225
|
+
"YOUR_CHANNEL_ID" /// your log channel id
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
```
|
|
412
230
|
|
|
413
231
|
</details>
|
|
414
232
|
|
|
415
|
-
|
|
233
|
+
## 🔧 Commands
|
|
234
|
+
|
|
235
|
+
- **Slash 🔧** and **Prefix 📨** Have Same Options
|
|
416
236
|
<details>
|
|
417
237
|
<summary>Options</summary>
|
|
418
238
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
239
|
+
```js
|
|
240
|
+
cooldown : 5, /// cooldown in seconds
|
|
241
|
+
permissions : ["ADMINISTRATOR"], /// permission for slash command
|
|
242
|
+
ownerOnly : true ,/// only owner can use slash command
|
|
243
|
+
devOnly : true /// only dev can use slash command
|
|
244
|
+
guildOnly : true /// only guild can use slash command
|
|
245
|
+
dmOnly : true /// only dm can use slash command
|
|
246
|
+
```
|
|
247
|
+
|
|
425
248
|
</details>
|
|
426
249
|
|
|
427
250
|
## Contributions
|
|
@@ -429,4 +252,3 @@ perms.checker(userId, guild, permToCheck)
|
|
|
429
252
|
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, feel free to contact us on discord.
|
|
430
253
|
|
|
431
254
|
[](https://discord.gg/CS2NRSPyze)
|
|
432
|
-
Package Sidebar
|