djs-builder 0.7.6 → 0.7.7

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 CHANGED
@@ -5,6 +5,8 @@
5
5
  **Welcome to the ultimate Discord Bot Utilities package! šŸ„**
6
6
  Boost your Discord bot development with ease, speed, and all-in-one features.
7
7
 
8
+ [![Discord Banner](https://api.weblutions.com/discord/invite/uYcKCZk3/)](https://discord.gg/uYcKCZk3)
9
+
8
10
  ---
9
11
 
10
12
  ## šŸ“‘ Table of Contents
@@ -64,6 +66,7 @@ const starterOptions = {
64
66
 
65
67
  database: {
66
68
  url: "mongodb://localhost:27017", // šŸ’¾ MongoDB connection
69
+ dbName: "yourDatabaseName", // šŸ“ Optional: Specify database name (default: "test")
67
70
  },
68
71
 
69
72
  anticrash: {
@@ -99,6 +102,7 @@ await starter(client, starterOptions);
99
102
 
100
103
  - Connects automatically to MongoDB šŸ’¾.
101
104
  - Useful for bots with persistent data storage.
105
+ - Specify the database name using the `dbName` option. If not specified, MongoDB uses "test" as the default database name.
102
106
 
103
107
  #### 3ļøāƒ£ Anticrash System
104
108
 
@@ -1579,6 +1583,38 @@ const { log, Log } = require("djs-builder");
1579
1583
 
1580
1584
  ---
1581
1585
 
1586
+ ### šŸ“‹ Simple Example
1587
+
1588
+ ```js
1589
+ const { log } = require("djs-builder");
1590
+
1591
+ module.exports = {
1592
+ name: "clientReady",
1593
+ async run(client) {
1594
+ const logData = [
1595
+ {
1596
+ guildId: "999888777666555444",
1597
+ channelId: "444555666777888999",
1598
+ },
1599
+
1600
+ {
1601
+ guildId: "999888777666555444",
1602
+ channelId: "444555666777888999",
1603
+ },
1604
+ ];
1605
+
1606
+ // Start logging with custom data
1607
+ await log(client, {
1608
+ Data: logData, // šŸ“Š Your configurations
1609
+ });
1610
+
1611
+ console.log("āœ… Logging system started with custom data!");
1612
+ },
1613
+ };
1614
+ ```
1615
+
1616
+ ---
1617
+
1582
1618
  ### ✨ Features
1583
1619
 
1584
1620
  - šŸ“ **Messages** – Deleted & edited messages are logged with details.
@@ -1690,6 +1726,9 @@ This method uses a predefined array of configurations – perfect for simple set
1690
1726
 
1691
1727
  **⚔ Setup in `clientReady` Event:**
1692
1728
 
1729
+
1730
+
1731
+
1693
1732
  ```js
1694
1733
  const { log } = require("djs-builder");
1695
1734
 
@@ -4180,4 +4219,4 @@ We welcome contributions! If you have any suggestions, bug reports, or feature r
4180
4219
 
4181
4220
  🌐 **Join our Discord:**
4182
4221
 
4183
- [![Discord Banner](https://api.weblutions.com/discord/invite/CS2NRSPyze/)](https://discord.gg/CS2NRSPyze)
4222
+ [![Discord Banner](https://api.weblutions.com/discord/invite/uYcKCZk3/)](https://discord.gg/uYcKCZk3)
package/handler/helper.js CHANGED
@@ -91,7 +91,7 @@ async function terminalInfo(client, options, data) {
91
91
  [rowColors[5]("Slash Commands"), rowColors[5](data.slash)],
92
92
  [rowColors[6]("Total Commands"), rowColors[6](data.slash + data.prefix)],
93
93
  [rowColors[7]("Events"), rowColors[7](data.events)],
94
- [rowColors[8]("Started At"), rowColors[8](new Date().toLocaleString())]
94
+ [rowColors[8]("Started At"), rowColors[8](new Date().toLocaleString())],
95
95
  );
96
96
 
97
97
  secondTable.push(
@@ -99,7 +99,7 @@ async function terminalInfo(client, options, data) {
99
99
  [
100
100
  rowColors[1]("Bot Invite"),
101
101
  rowColors[1](
102
- `https://discord.com/oauth2/authorize?client_id=${client.user.id}&permissions=8&integration_type=0&scope=bot`
102
+ `https://discord.com/oauth2/authorize?client_id=${client.user.id}&permissions=8&integration_type=0&scope=bot`,
103
103
  ),
104
104
  ],
105
105
  [
@@ -113,9 +113,9 @@ async function terminalInfo(client, options, data) {
113
113
  ? Array.isArray(options.Status.activities)
114
114
  ? options.Status.activities[0]
115
115
  : options.Status.activities
116
- : "Not Defined"
116
+ : "Not Defined",
117
117
  ),
118
- ]
118
+ ],
119
119
  );
120
120
 
121
121
  if (options.database?.url) {
@@ -138,7 +138,7 @@ async function terminalInfo(client, options, data) {
138
138
  [rowColors[0]("Status"), rowColors[0]("āœ… Online")],
139
139
  [rowColors[1]("URL"), rowColors[1](`http://localhost:${port}`)],
140
140
  [rowColors[2]("Port"), rowColors[2](port)],
141
- [rowColors[3]("Version"), rowColors[3]("v2.0.0")]
141
+ [rowColors[3]("Version"), rowColors[3]("v2.0.0")],
142
142
  );
143
143
  }
144
144
 
@@ -154,10 +154,14 @@ async function terminalInfo(client, options, data) {
154
154
  }
155
155
  }
156
156
 
157
- async function data_conecter(url) {
157
+ async function data_conecter(options) {
158
158
  try {
159
159
  const mongoose = require("mongoose");
160
- await mongoose.connect(url);
160
+ const connectOptions = {};
161
+ if (options.dbName) {
162
+ connectOptions.dbName = options.dbName;
163
+ }
164
+ await mongoose.connect(options.url, connectOptions);
161
165
  return true;
162
166
  } catch (error) {
163
167
  console.error("āŒ Failed to connect to the database:", error);
@@ -243,9 +247,7 @@ async function cmd_log(client, data, commandName, channelId) {
243
247
  },
244
248
  {
245
249
  name: "šŸ‘¤ User:",
246
- value: `- ${user?.tag ?? "Unknown user"} \n- (\`${
247
- user?.id ?? "Unknown ID"
248
- }\`)`,
250
+ value: `- ${user?.tag ?? "Unknown user"} \n- (\`${user?.id ?? "Unknown ID"}\`)`,
249
251
  inline: true,
250
252
  },
251
253
  { name: "\u200B", value: "\u200B", inline: true },
@@ -269,7 +271,7 @@ async function cmd_log(client, data, commandName, channelId) {
269
271
  value:
270
272
  messageLink !== "Unknown" ? `- [Link](${messageLink})` : "Not found",
271
273
  inline: true,
272
- }
274
+ },
273
275
  );
274
276
  } else {
275
277
  fields.push({
@@ -319,7 +321,7 @@ async function update(client, id, webhookURL) {
319
321
  const { version, note: localNote } = require("../package.json");
320
322
 
321
323
  const { data } = await axios.get(
322
- `https://registry.npmjs.org/djs-builder/latest`
324
+ `https://registry.npmjs.org/djs-builder/latest`,
323
325
  );
324
326
  const new_version = data.version;
325
327
  const note = data.note || "";
@@ -334,8 +336,8 @@ async function update(client, id, webhookURL) {
334
336
  if (new_version !== version) {
335
337
  console.log(
336
338
  chalk.yellow(
337
- `āš ļø New version available: ${new_version} (Your version: ${version})`
338
- )
339
+ `āš ļø New version available: ${new_version} (Your version: ${version})`,
340
+ ),
339
341
  );
340
342
 
341
343
  const crash = new WebhookClient({ url: webhookURL });
@@ -343,12 +345,15 @@ async function update(client, id, webhookURL) {
343
345
  const embed = new EmbedBuilder()
344
346
  .setTitle("šŸŽ‰ New version available")
345
347
  .setDescription(
346
- `${note}\n\n**Your version:** ${version} ā°\n**New version:** ${new_version} šŸš€\n- Try running \`npm i djs-builder@latest\` to update. ā¤`
348
+ `${note}\n\n**Your version:** ${version} ā°\n**New version:** ${new_version} šŸš€\n- Try running \`npm i djs-builder@latest\` to update. ā¤`,
347
349
  )
348
350
  .setColor("Yellow")
349
351
  .setTimestamp();
350
352
 
351
353
  await crash.send({ content: `<@${id}>`, embeds: [embed] }).catch((e) => {});
354
+ } else if (note && note !== localNote) {
355
+ console.log(chalk.cyan("šŸ“ New note available without version change:"));
356
+ console.log(note);
352
357
  }
353
358
 
354
359
  client.djs_builder_version = new_version;
@@ -86,7 +86,7 @@ async function loadEvents(client, path) {
86
86
  for (const file of event_files) {
87
87
  const event = require(file.path);
88
88
 
89
- if (!event.name || typeof event.run !== "function") continue;
89
+ if (!event.name || (typeof event.run !== "function" && typeof event.execute !== "function")) continue;
90
90
 
91
91
  let listener;
92
92
  if (event.once) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "djs-builder",
3
- "version": "0.7.6",
4
- "note": "šŸŽ‰ Package Update v0.7.6! \n\n- 🧩 NEW: CreateComponents Function!\n • Build advanced Discord UI (Text, Separator, Media, File, Button, Menu, Section)\n • Container mode for Components V2 | Array mode for standard messages\n • Full documentation with examples\n\n- šŸ”³ NEW: CreateModal Function!\n • Create Discord Modals with Text Inputs, Menus, Files, and Labels\n\n- 🌐 NEW: Dashboard System!\n • Discord OAuth2 Login\n • Server, Level, Giveaway & Blacklist Management\n • Logs Management Page (Enable/Disable events, custom channels & colors)\n • Standalone usage - works with or without Starter\n\n- šŸ›”ļø Logging System Enhancements!\n • Dashboard Integration with Smart Cache System\n • Read-only Mode for code-based configs\n • Channel Fallback & Better Slash Command support\n\n- šŸ”§ Bug Fixes: Schema validation, cache updates, sidebar navigation\n\nšŸ”— Learn more on [NPM](https://www.npmjs.com/package/djs-builder)",
3
+ "version": "0.7.7",
4
+ "note": "šŸŽ‰ Package Update v0.7.6! \n\n- 🧩 NEW: CreateComponents Function!\n • Build advanced Discord UI (Text, Separator, Media, File, Button, Menu, Section)\n • Container mode for Components V2 | Array mode for standard messages\n • Full documentation with examples\n\n- šŸ”³ NEW: CreateModal Function!\n • Create Discord Modals with Text Inputs, Menus, Files, and Labels\n\n- 🌐 NEW: Dashboard System!\n • Discord OAuth2 Login\n • Server, Level, Giveaway & Blacklist Management\n • Logs Management Page (Enable/Disable events, custom channels & colors)\n • Standalone usage - works with or without Starter\n\n- šŸ›”ļø Logging System Enhancements!\n • Dashboard Integration with Smart Cache System\n • Read-only Mode for code-based configs\n • Channel Fallback & Better Slash Command support\n\n- šŸ”§ Bug Fixes: Schema validation, cache updates, sidebar navigation\n\nšŸ”— Learn more on [NPM](https://www.npmjs.com/package/djs-builder)\n DISCORD SERVER : [LINK](https://discord.gg/uYcKCZk3)",
5
5
  "description": "šŸŽ‰ Full-featured Discord.js utilities: CreateComponents, CreateModal, Dashboard, Logging & more! šŸ„",
6
6
  "main": "handler/starter.js",
7
7
  "dependencies": {