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