djs-builder 0.7.5 ā 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 +40 -1
- package/function/dash.js +218 -146
- package/function/function.js +2 -2
- package/handler/helper.js +28 -38
- package/handler/starter.js +1 -1
- package/package.json +2 -2
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
|
+
[](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
|
-
[](https://discord.gg/uYcKCZk3)
|
package/function/dash.js
CHANGED
|
@@ -13,10 +13,6 @@ const path = require("path");
|
|
|
13
13
|
const Table = require("cli-table3");
|
|
14
14
|
const chalk = require("chalk");
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
16
|
const { Level } = require("./level");
|
|
21
17
|
const {
|
|
22
18
|
Blacklist,
|
|
@@ -29,7 +25,7 @@ const {
|
|
|
29
25
|
Greroll,
|
|
30
26
|
Gpause,
|
|
31
27
|
Gresume,
|
|
32
|
-
Gdelete
|
|
28
|
+
Gdelete,
|
|
33
29
|
} = require("./giveaway");
|
|
34
30
|
const { Log, getLogConfigData } = require("./log");
|
|
35
31
|
|
|
@@ -42,15 +38,15 @@ function dashboard(client, options) {
|
|
|
42
38
|
const app = express();
|
|
43
39
|
const {
|
|
44
40
|
clientSecret,
|
|
45
|
-
callbackURL =
|
|
46
|
-
sessionSecret
|
|
41
|
+
callbackURL = "http://localhost:3000/auth/discord/callback",
|
|
42
|
+
sessionSecret,
|
|
47
43
|
port = 3000,
|
|
48
44
|
} = options;
|
|
49
45
|
|
|
50
46
|
clientID = client.user.id;
|
|
51
47
|
// Ų„Ų¹ŲÆŲ§ŲÆ Ų§ŁŁ
Ų³Ų§Ų±Ų§ŲŖ
|
|
52
48
|
app.set("view engine", "ejs");
|
|
53
|
-
app.set("views", path.join(__dirname, "..", "views"));
|
|
49
|
+
app.set("views", path.join(__dirname, "..", "views"));
|
|
54
50
|
app.use(express.json());
|
|
55
51
|
app.use(express.urlencoded({ extended: true }));
|
|
56
52
|
|
|
@@ -111,11 +107,12 @@ function dashboard(client, options) {
|
|
|
111
107
|
}
|
|
112
108
|
|
|
113
109
|
// Ł
ŲŲ§ŁŁŲ© Ų§ŁŲŲµŁŁ Ų¹ŁŁ Ų§ŁŲØŲ§ŲÆŲ¦Ų© Ł
Ł client
|
|
114
|
-
const prefix = client.prefix || options.prefix ||
|
|
110
|
+
const prefix = client.prefix || options.prefix || "-";
|
|
115
111
|
|
|
116
112
|
return {
|
|
117
113
|
guilds: client.guilds?.cache?.size || 0,
|
|
118
|
-
users:
|
|
114
|
+
users:
|
|
115
|
+
client.guilds?.cache?.reduce((acc, g) => acc + g.memberCount, 0) || 0,
|
|
119
116
|
channels: client.channels?.cache?.size || 0,
|
|
120
117
|
slashCommands: client.slashCommands?.size || 0,
|
|
121
118
|
prefixCommands: uniquePrefixCommands.size,
|
|
@@ -171,12 +168,11 @@ function dashboard(client, options) {
|
|
|
171
168
|
// ŁŁŲŲ© Ų§ŁŲŖŲŁŁ
Ų§ŁŲ±Ų¦ŁŲ³ŁŲ©
|
|
172
169
|
app.get("/dashboard", isAuthenticated, (req, res) => {
|
|
173
170
|
const userGuilds = req.user.guilds.filter(
|
|
174
|
-
(g) =>
|
|
175
|
-
(g.permissions & 0x20) === 0x20 && client.guilds.cache.has(g.id)
|
|
171
|
+
(g) => (g.permissions & 0x20) === 0x20 && client.guilds.cache.has(g.id)
|
|
176
172
|
);
|
|
177
|
-
res.render("dashboard", {
|
|
173
|
+
res.render("dashboard", {
|
|
178
174
|
guilds: userGuilds,
|
|
179
|
-
botStats: getBotStats()
|
|
175
|
+
botStats: getBotStats(),
|
|
180
176
|
});
|
|
181
177
|
});
|
|
182
178
|
|
|
@@ -197,8 +193,13 @@ function dashboard(client, options) {
|
|
|
197
193
|
|
|
198
194
|
try {
|
|
199
195
|
if (Level) levelCount = await Level.countDocuments({ guildId: guild.id });
|
|
200
|
-
if (giveaway)
|
|
201
|
-
|
|
196
|
+
if (giveaway)
|
|
197
|
+
giveawayCount = await giveaway.countDocuments({
|
|
198
|
+
guildId: guild.id,
|
|
199
|
+
ended: false,
|
|
200
|
+
});
|
|
201
|
+
if (Blacklist)
|
|
202
|
+
blacklistCount = await Blacklist.countDocuments({ guild: guild.id });
|
|
202
203
|
} catch (e) {
|
|
203
204
|
console.error("Stats error:", e);
|
|
204
205
|
}
|
|
@@ -215,7 +216,7 @@ function dashboard(client, options) {
|
|
|
215
216
|
activeGiveaways: giveawayCount,
|
|
216
217
|
blacklisted: blacklistCount,
|
|
217
218
|
},
|
|
218
|
-
botStats: getBotStats()
|
|
219
|
+
botStats: getBotStats(),
|
|
219
220
|
});
|
|
220
221
|
});
|
|
221
222
|
|
|
@@ -227,7 +228,7 @@ function dashboard(client, options) {
|
|
|
227
228
|
const slashCommands = client.slashCommands
|
|
228
229
|
? Array.from(client.slashCommands.values())
|
|
229
230
|
: [];
|
|
230
|
-
|
|
231
|
+
|
|
231
232
|
// Ų„Ų²Ų§ŁŲ© Ų§ŁŲŖŁŲ±Ų§Ų±Ų§ŲŖ Ł
Ł prefix commands
|
|
232
233
|
const uniquePrefixCommands = [];
|
|
233
234
|
const seen = new Set();
|
|
@@ -245,7 +246,7 @@ function dashboard(client, options) {
|
|
|
245
246
|
slashCommands,
|
|
246
247
|
prefixCommands: uniquePrefixCommands,
|
|
247
248
|
page: "commands",
|
|
248
|
-
botStats: getBotStats()
|
|
249
|
+
botStats: getBotStats(),
|
|
249
250
|
});
|
|
250
251
|
});
|
|
251
252
|
|
|
@@ -269,7 +270,7 @@ function dashboard(client, options) {
|
|
|
269
270
|
guild,
|
|
270
271
|
leaderboard: leaderboardData,
|
|
271
272
|
page: "levels",
|
|
272
|
-
botStats: getBotStats()
|
|
273
|
+
botStats: getBotStats(),
|
|
273
274
|
});
|
|
274
275
|
});
|
|
275
276
|
|
|
@@ -289,72 +290,82 @@ function dashboard(client, options) {
|
|
|
289
290
|
});
|
|
290
291
|
|
|
291
292
|
// ==================== ŁŲøŲ§Ł
Ų§ŁŲ¬ŁŁ Ų§ŁŁ ====================
|
|
292
|
-
app.get(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
293
|
+
app.get(
|
|
294
|
+
"/dashboard/:guildId/giveaways",
|
|
295
|
+
isAuthenticated,
|
|
296
|
+
async (req, res) => {
|
|
297
|
+
const guild = client.guilds.cache.get(req.params.guildId);
|
|
298
|
+
if (!guild) return res.redirect("/dashboard");
|
|
299
|
+
|
|
300
|
+
let giveaways = [];
|
|
301
|
+
if (giveaway) {
|
|
302
|
+
try {
|
|
303
|
+
giveaways = await giveaway
|
|
304
|
+
.find({ guildId: guild.id })
|
|
305
|
+
.sort({ endTime: -1 });
|
|
306
|
+
} catch (e) {
|
|
307
|
+
console.error("Error fetching giveaways:", e);
|
|
308
|
+
}
|
|
302
309
|
}
|
|
303
|
-
}
|
|
304
310
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
311
|
+
res.render("giveaways", {
|
|
312
|
+
guild,
|
|
313
|
+
giveaways,
|
|
314
|
+
page: "giveaways",
|
|
315
|
+
botStats: getBotStats(),
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
);
|
|
312
319
|
|
|
313
320
|
// API ŁŁŲ¬ŁŁ Ų§ŁŁ
|
|
314
|
-
app.post(
|
|
315
|
-
|
|
316
|
-
|
|
321
|
+
app.post(
|
|
322
|
+
"/api/:guildId/giveaway/:action",
|
|
323
|
+
isAuthenticated,
|
|
324
|
+
async (req, res) => {
|
|
325
|
+
const { guildId, action } = req.params;
|
|
326
|
+
const { messageId } = req.body;
|
|
317
327
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
328
|
+
try {
|
|
329
|
+
let result = { success: true };
|
|
330
|
+
switch (action) {
|
|
331
|
+
case "pause":
|
|
332
|
+
if (Gpause) await Gpause(client, messageId);
|
|
333
|
+
break;
|
|
334
|
+
case "resume":
|
|
335
|
+
// ŲŖŁŁŁŲ° ŁŲÆŁŁ ŁŁŲ§Ų³ŲŖŲ¦ŁŲ§Ł ŁŲ£Ł Gresume ŁŁ djs-builder ŁŲŲŖŁŁ Ų¹ŁŁ Ų®Ų·Ų£
|
|
336
|
+
if (Gresume) await Gresume(client, messageId);
|
|
337
|
+
break;
|
|
338
|
+
case "end":
|
|
339
|
+
// Ų„ŁŁŲ§Ų” Ų§ŁŲ¬ŁŁ Ų§ŁŁ ŁŁŲ±Ų§Ł ŲØŲŖŲ¹ŲÆŁŁ ŁŁŲŖ Ų§ŁŲ§ŁŲŖŁŲ§Ų” ŁŁŁŁŲŖ Ų§ŁŲŲ§ŁŁ
|
|
340
|
+
if (giveaway) {
|
|
341
|
+
const g = await giveaway.findOne({ messageId });
|
|
342
|
+
if (g && !g.ended) {
|
|
343
|
+
// Ų„Ų°Ų§ ŁŲ§Ł Ł
ŲŖŁŁŁŲ§Ł Ł
Ų¤ŁŲŖŲ§ŁŲ ŁŁŲŗŁ Ų§ŁŲ„ŁŁŲ§Ł Ų£ŁŁŲ§Ł
|
|
344
|
+
await giveaway.findOneAndUpdate(
|
|
345
|
+
{ messageId },
|
|
346
|
+
{ paused: false, endTime: Date.now().toString() }
|
|
347
|
+
);
|
|
348
|
+
// Ų„Ų¹Ų·Ų§Ų” Gcheck ŁŲ±ŲµŲ© ŁŁŲŖŲ“ŲŗŁŁ
|
|
349
|
+
setTimeout(() => Gcheck && Gcheck(client), 1000);
|
|
350
|
+
}
|
|
340
351
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
352
|
+
break;
|
|
353
|
+
case "reroll":
|
|
354
|
+
if (Greroll) await Greroll(client, messageId);
|
|
355
|
+
break;
|
|
356
|
+
case "delete":
|
|
357
|
+
if (Gdelete) await Gdelete(messageId);
|
|
358
|
+
break;
|
|
359
|
+
default:
|
|
360
|
+
return res.json({ success: false, error: "Invalid action" });
|
|
361
|
+
}
|
|
362
|
+
res.json({ success: true, message: `ŲŖŁ
ŲŖŁŁŁŲ° ${action} ŲØŁŲ¬Ų§Ų` });
|
|
363
|
+
} catch (e) {
|
|
364
|
+
console.error("Giveaway action error:", e);
|
|
365
|
+
res.json({ success: false, error: e.message });
|
|
351
366
|
}
|
|
352
|
-
res.json({ success: true, message: `ŲŖŁ
ŲŖŁŁŁŲ° ${action} ŲØŁŲ¬Ų§Ų` });
|
|
353
|
-
} catch (e) {
|
|
354
|
-
console.error("Giveaway action error:", e);
|
|
355
|
-
res.json({ success: false, error: e.message });
|
|
356
367
|
}
|
|
357
|
-
|
|
368
|
+
);
|
|
358
369
|
|
|
359
370
|
// ==================== ŁŲøŲ§Ł
Ų§ŁŲ³Ų¬ŁŲ§ŲŖ (Logs) ====================
|
|
360
371
|
// ŁŲ§Ų¦Ł
Ų© Ų£ŁŁŲ§Ų¹ Ų§ŁŲ£ŲŲÆŲ§Ų« Ų§ŁŁ
ŲÆŲ¹ŁŁ
Ų©
|
|
@@ -365,20 +376,48 @@ function dashboard(client, options) {
|
|
|
365
376
|
{ name: "ŲŲ°Ł ŁŁŲ§Ų©", value: "channelDelete", icon: "ri-close-circle-line" },
|
|
366
377
|
{ name: "ŲŖŲ¹ŲÆŁŁ ŁŁŲ§Ų©", value: "channelUpdate", icon: "ri-settings-3-line" },
|
|
367
378
|
{ name: "Ų§ŁŲ¶Ł
Ų§Ł
Ų¹Ų¶Ł", value: "guildMemberAdd", icon: "ri-user-add-line" },
|
|
368
|
-
{
|
|
379
|
+
{
|
|
380
|
+
name: "Ł
ŲŗŲ§ŲÆŲ±Ų© Ų¹Ų¶Ł",
|
|
381
|
+
value: "guildMemberRemove",
|
|
382
|
+
icon: "ri-user-unfollow-line",
|
|
383
|
+
},
|
|
369
384
|
{ name: "ŲŲøŲ± Ų¹Ų¶Ł", value: "guildBanAdd", icon: "ri-forbid-line" },
|
|
370
|
-
{
|
|
385
|
+
{
|
|
386
|
+
name: "Ų±ŁŲ¹ Ų§ŁŲŲøŲ±",
|
|
387
|
+
value: "guildBanRemove",
|
|
388
|
+
icon: "ri-checkbox-circle-line",
|
|
389
|
+
},
|
|
371
390
|
{ name: "Ų„ŁŲ“Ų§Ų” Ų±ŲŖŲØŲ©", value: "roleCreate", icon: "ri-shield-star-line" },
|
|
372
391
|
{ name: "ŲŲ°Ł Ų±ŲŖŲØŲ©", value: "roleDelete", icon: "ri-shield-cross-line" },
|
|
373
392
|
{ name: "ŲŖŲ¹ŲÆŁŁ Ų±ŲŖŲØŲ©", value: "roleUpdate", icon: "ri-shield-line" },
|
|
374
|
-
{
|
|
393
|
+
{
|
|
394
|
+
name: "ŲŖŲŗŁŁŲ± Ų±ŲŖŲØ Ų§ŁŲ¹Ų¶Ł",
|
|
395
|
+
value: "guildMemberUpdate",
|
|
396
|
+
icon: "ri-user-settings-line",
|
|
397
|
+
},
|
|
375
398
|
{ name: "ŁŲ“Ų§Ų· ŲµŁŲŖŁ", value: "voiceStateUpdate", icon: "ri-mic-line" },
|
|
376
399
|
{ name: "Ų„ŁŲ“Ų§Ų” ŲÆŲ¹ŁŲ©", value: "inviteCreate", icon: "ri-links-line" },
|
|
377
|
-
{
|
|
378
|
-
|
|
400
|
+
{
|
|
401
|
+
name: "Ų„Ų¶Ų§ŁŲ© Ų„ŁŁ
ŁŲ¬Ł",
|
|
402
|
+
value: "emojiCreate",
|
|
403
|
+
icon: "ri-emotion-happy-line",
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: "ŲŲ°Ł Ų„ŁŁ
ŁŲ¬Ł",
|
|
407
|
+
value: "emojiDelete",
|
|
408
|
+
icon: "ri-emotion-unhappy-line",
|
|
409
|
+
},
|
|
379
410
|
{ name: "ŲŖŲ¹ŲÆŁŁ Ų„ŁŁ
ŁŲ¬Ł", value: "emojiUpdate", icon: "ri-emotion-line" },
|
|
380
|
-
{
|
|
381
|
-
|
|
411
|
+
{
|
|
412
|
+
name: "Ų„Ų¶Ų§ŁŲ© Ų³ŲŖŁŁŲ±",
|
|
413
|
+
value: "stickerCreate",
|
|
414
|
+
icon: "ri-sticky-note-line",
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: "ŲŲ°Ł Ų³ŲŖŁŁŲ±",
|
|
418
|
+
value: "stickerDelete",
|
|
419
|
+
icon: "ri-sticky-note-2-line",
|
|
420
|
+
},
|
|
382
421
|
{ name: "ŲŖŲ¹ŲÆŁŁ Ų³ŲŖŁŁŲ±", value: "stickerUpdate", icon: "ri-file-edit-line" },
|
|
383
422
|
];
|
|
384
423
|
|
|
@@ -408,7 +447,7 @@ function dashboard(client, options) {
|
|
|
408
447
|
}
|
|
409
448
|
} else {
|
|
410
449
|
// ŁŲ¶Ų¹ Code - ŁŲ±Ų§Ų”Ų© Ł
Ł Ų§ŁŁŁŲÆ Ų§ŁŁ
ŁŲŖŁŲØ
|
|
411
|
-
const codeConfig = logData.configs.find(c => c.guildId === guild.id);
|
|
450
|
+
const codeConfig = logData.configs.find((c) => c.guildId === guild.id);
|
|
412
451
|
if (codeConfig) {
|
|
413
452
|
logConfig = codeConfig;
|
|
414
453
|
configSource = "code";
|
|
@@ -417,15 +456,19 @@ function dashboard(client, options) {
|
|
|
417
456
|
|
|
418
457
|
// Ų§ŁŲŲµŁŁ Ų¹ŁŁ ŁŁŁŲ§ŲŖ Ų§ŁŲ³ŁŲ±ŁŲ± Ų§ŁŁŲµŁŲ©
|
|
419
458
|
const channels = guild.channels.cache
|
|
420
|
-
.filter(c => c.type === 0) // GuildText
|
|
421
|
-
.map(c => ({ id: c.id, name: c.name }))
|
|
459
|
+
.filter((c) => c.type === 0) // GuildText
|
|
460
|
+
.map((c) => ({ id: c.id, name: c.name }))
|
|
422
461
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
423
462
|
|
|
424
463
|
// ŲŲ³Ų§ŲØ Ų§ŁŲ„ŲŲµŲ§Ų¦ŁŲ§ŲŖ
|
|
425
464
|
const disabledEvents = logConfig?.disable?.length || 0;
|
|
426
465
|
const enabledEvents = LOG_EVENT_TYPES.length - disabledEvents;
|
|
427
|
-
const customColors = logConfig?.colors
|
|
428
|
-
|
|
466
|
+
const customColors = logConfig?.colors
|
|
467
|
+
? Object.keys(logConfig.colors).length
|
|
468
|
+
: 0;
|
|
469
|
+
const customChannels = logConfig?.channels
|
|
470
|
+
? Object.keys(logConfig.channels).length
|
|
471
|
+
: 0;
|
|
429
472
|
|
|
430
473
|
res.render("logs", {
|
|
431
474
|
guild,
|
|
@@ -439,14 +482,15 @@ function dashboard(client, options) {
|
|
|
439
482
|
enabledEvents,
|
|
440
483
|
disabledEvents,
|
|
441
484
|
customColors,
|
|
442
|
-
customChannels
|
|
485
|
+
customChannels,
|
|
443
486
|
});
|
|
444
487
|
});
|
|
445
488
|
|
|
446
489
|
// API - ŲŖŲŲÆŁŲ« Ų§ŁŁŁŲ§Ų© Ų§ŁŲ§ŁŲŖŲ±Ų§Ų¶ŁŲ©
|
|
447
490
|
app.post("/api/:guildId/logs/channel", isAuthenticated, async (req, res) => {
|
|
448
491
|
const logData = getLogConfigData();
|
|
449
|
-
if (!logData.databaseEnabled)
|
|
492
|
+
if (!logData.databaseEnabled)
|
|
493
|
+
return res.json({ error: "ŁŲ¬ŲØ ŲŖŁŲ¹ŁŁ ŁŲ¶Ų¹ Database ŁŲŖŲ¹ŲÆŁŁ Ų§ŁŲ„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ" });
|
|
450
494
|
|
|
451
495
|
const { channelId } = req.body;
|
|
452
496
|
const guildId = req.params.guildId;
|
|
@@ -468,7 +512,8 @@ function dashboard(client, options) {
|
|
|
468
512
|
// API - ŲŖŁŲ¹ŁŁ/ŲŖŲ¹Ų·ŁŁ ŲŲÆŲ«
|
|
469
513
|
app.post("/api/:guildId/logs/toggle", isAuthenticated, async (req, res) => {
|
|
470
514
|
const logData = getLogConfigData();
|
|
471
|
-
if (!logData.databaseEnabled)
|
|
515
|
+
if (!logData.databaseEnabled)
|
|
516
|
+
return res.json({ error: "ŁŲ¬ŲØ ŲŖŁŲ¹ŁŁ ŁŲ¶Ų¹ Database ŁŲŖŲ¹ŲÆŁŁ Ų§ŁŲ„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ" });
|
|
472
517
|
|
|
473
518
|
const { eventType, enable } = req.body;
|
|
474
519
|
const guildId = req.params.guildId;
|
|
@@ -501,14 +546,15 @@ function dashboard(client, options) {
|
|
|
501
546
|
// API - ŲŖŲŲÆŁŲ« Ų„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ ŲŲÆŲ« Ł
Ų¹ŁŁ
|
|
502
547
|
app.post("/api/:guildId/logs/event", isAuthenticated, async (req, res) => {
|
|
503
548
|
const logData = getLogConfigData();
|
|
504
|
-
if (!logData.databaseEnabled)
|
|
549
|
+
if (!logData.databaseEnabled)
|
|
550
|
+
return res.json({ error: "ŁŲ¬ŲØ ŲŖŁŲ¹ŁŁ ŁŲ¶Ų¹ Database ŁŲŖŲ¹ŲÆŁŁ Ų§ŁŲ„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ" });
|
|
505
551
|
|
|
506
552
|
const { eventType, channel, color } = req.body;
|
|
507
553
|
const guildId = req.params.guildId;
|
|
508
554
|
|
|
509
555
|
try {
|
|
510
556
|
const updateObj = {};
|
|
511
|
-
|
|
557
|
+
|
|
512
558
|
if (channel) {
|
|
513
559
|
updateObj[`channels.${eventType}`] = channel;
|
|
514
560
|
} else {
|
|
@@ -518,7 +564,7 @@ function dashboard(client, options) {
|
|
|
518
564
|
{ $unset: { [`channels.${eventType}`]: "" } }
|
|
519
565
|
);
|
|
520
566
|
}
|
|
521
|
-
|
|
567
|
+
|
|
522
568
|
if (color) {
|
|
523
569
|
updateObj[`colors.${eventType}`] = color;
|
|
524
570
|
} else {
|
|
@@ -549,7 +595,8 @@ function dashboard(client, options) {
|
|
|
549
595
|
// API - Ų„Ų¹Ų§ŲÆŲ© ŲŖŲ¹ŁŁŁ Ų„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ Ų§ŁŲ³Ų¬ŁŲ§ŲŖ
|
|
550
596
|
app.post("/api/:guildId/logs/reset", isAuthenticated, async (req, res) => {
|
|
551
597
|
const logData = getLogConfigData();
|
|
552
|
-
if (!logData.databaseEnabled)
|
|
598
|
+
if (!logData.databaseEnabled)
|
|
599
|
+
return res.json({ error: "ŁŲ¬ŲØ ŲŖŁŲ¹ŁŁ ŁŲ¶Ų¹ Database ŁŲŖŲ¹ŲÆŁŁ Ų§ŁŲ„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ" });
|
|
553
600
|
|
|
554
601
|
const guildId = req.params.guildId;
|
|
555
602
|
|
|
@@ -565,52 +612,60 @@ function dashboard(client, options) {
|
|
|
565
612
|
|
|
566
613
|
// ==================== ŁŲøŲ§Ł
Ų§ŁŲØŁŲ§Ł ŁŁŲ³ŲŖ ====================
|
|
567
614
|
// API ŁŲ„Ų¶Ų§ŁŲ© ŁŁŲØŁŲ§Ł ŁŁŲ³ŲŖ
|
|
568
|
-
app.post(
|
|
569
|
-
|
|
570
|
-
|
|
615
|
+
app.post(
|
|
616
|
+
"/api/guild/:guildId/blacklist",
|
|
617
|
+
isAuthenticated,
|
|
618
|
+
async (req, res) => {
|
|
619
|
+
const { type, id } = req.body;
|
|
620
|
+
const guildId = req.params.guildId;
|
|
571
621
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
622
|
+
try {
|
|
623
|
+
if (addToBlacklist) {
|
|
624
|
+
const result = await addToBlacklist(guildId, type, id);
|
|
625
|
+
return res.json({ success: result });
|
|
626
|
+
} else if (Blacklist) {
|
|
627
|
+
const exists = await Blacklist.findOne({ guild: guildId, type, id });
|
|
628
|
+
if (!exists) {
|
|
629
|
+
await Blacklist.create({ guild: guildId, type, id });
|
|
630
|
+
}
|
|
631
|
+
return res.json({ success: true });
|
|
580
632
|
}
|
|
581
|
-
|
|
633
|
+
res.json({ error: "Blacklist system not available" });
|
|
634
|
+
} catch (e) {
|
|
635
|
+
res.json({ success: false, error: e.message });
|
|
582
636
|
}
|
|
583
|
-
res.json({ error: "Blacklist system not available" });
|
|
584
|
-
} catch (e) {
|
|
585
|
-
res.json({ success: false, error: e.message });
|
|
586
637
|
}
|
|
587
|
-
|
|
638
|
+
);
|
|
588
639
|
|
|
589
640
|
// API ŁŲŲ°Ł Ł
Ł Ų§ŁŲØŁŲ§Ł ŁŁŲ³ŲŖ
|
|
590
|
-
app.delete(
|
|
591
|
-
|
|
592
|
-
|
|
641
|
+
app.delete(
|
|
642
|
+
"/api/guild/:guildId/blacklist",
|
|
643
|
+
isAuthenticated,
|
|
644
|
+
async (req, res) => {
|
|
645
|
+
const { type, id } = req.body;
|
|
646
|
+
const guildId = req.params.guildId;
|
|
593
647
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
648
|
+
try {
|
|
649
|
+
if (removeFromBlacklist) {
|
|
650
|
+
const result = await removeFromBlacklist(guildId, type, id);
|
|
651
|
+
return res.json({ success: result });
|
|
652
|
+
} else if (Blacklist) {
|
|
653
|
+
await Blacklist.deleteOne({ guild: guildId, type, id });
|
|
654
|
+
return res.json({ success: true });
|
|
655
|
+
}
|
|
656
|
+
res.json({ error: "Blacklist system not available" });
|
|
657
|
+
} catch (e) {
|
|
658
|
+
res.json({ success: false, error: e.message });
|
|
601
659
|
}
|
|
602
|
-
res.json({ error: "Blacklist system not available" });
|
|
603
|
-
} catch (e) {
|
|
604
|
-
res.json({ success: false, error: e.message });
|
|
605
660
|
}
|
|
606
|
-
|
|
661
|
+
);
|
|
607
662
|
|
|
608
663
|
// ==================== API Ų§ŁŁŲ§Ų¦Ł
Ų© Ų§ŁŲ³ŁŲÆŲ§Ų” Ų§ŁŲ¹Ų§Ł
Ų© ====================
|
|
609
664
|
app.get("/api/blacklist/:type", isAuthenticated, async (req, res) => {
|
|
610
665
|
const { type } = req.params;
|
|
611
666
|
try {
|
|
612
667
|
if (Blacklist) {
|
|
613
|
-
const typeMap = { users:
|
|
668
|
+
const typeMap = { users: "user", roles: "role", channels: "channel" };
|
|
614
669
|
const items = await Blacklist.find({ type: typeMap[type] || type });
|
|
615
670
|
return res.json({ items });
|
|
616
671
|
}
|
|
@@ -626,7 +681,7 @@ function dashboard(client, options) {
|
|
|
626
681
|
if (Blacklist) {
|
|
627
682
|
const exists = await Blacklist.findOne({ type, id });
|
|
628
683
|
if (!exists) {
|
|
629
|
-
await Blacklist.create({ type, id, guild:
|
|
684
|
+
await Blacklist.create({ type, id, guild: "global" });
|
|
630
685
|
}
|
|
631
686
|
return res.json({ success: true });
|
|
632
687
|
}
|
|
@@ -652,14 +707,16 @@ function dashboard(client, options) {
|
|
|
652
707
|
// API ŁŲ¬ŁŲØ ŲØŁŲ§ŁŲ§ŲŖ Ł
Ų³ŲŖŲ®ŲÆŁ
(Ų¹Ų§Ł
)
|
|
653
708
|
app.get("/api/user/:userId", isAuthenticated, async (req, res) => {
|
|
654
709
|
try {
|
|
655
|
-
const user = await client.users
|
|
710
|
+
const user = await client.users
|
|
711
|
+
.fetch(req.params.userId)
|
|
712
|
+
.catch(() => null);
|
|
656
713
|
if (user) {
|
|
657
714
|
return res.json({
|
|
658
715
|
id: user.id,
|
|
659
716
|
username: user.username,
|
|
660
717
|
global_name: user.globalName,
|
|
661
718
|
avatar: user.avatar,
|
|
662
|
-
discriminator: user.discriminator
|
|
719
|
+
discriminator: user.discriminator,
|
|
663
720
|
});
|
|
664
721
|
}
|
|
665
722
|
res.json({ error: "User not found" });
|
|
@@ -675,7 +732,9 @@ function dashboard(client, options) {
|
|
|
675
732
|
if (!guild) return res.json({ error: "Guild not found" });
|
|
676
733
|
|
|
677
734
|
try {
|
|
678
|
-
const member = await guild.members
|
|
735
|
+
const member = await guild.members
|
|
736
|
+
.fetch(req.params.userId)
|
|
737
|
+
.catch(() => null);
|
|
679
738
|
if (member) {
|
|
680
739
|
return res.json({
|
|
681
740
|
user: {
|
|
@@ -683,9 +742,9 @@ function dashboard(client, options) {
|
|
|
683
742
|
username: member.user.username,
|
|
684
743
|
global_name: member.user.globalName,
|
|
685
744
|
avatar: member.user.avatar,
|
|
686
|
-
discriminator: member.user.discriminator
|
|
745
|
+
discriminator: member.user.discriminator,
|
|
687
746
|
},
|
|
688
|
-
displayName: member.displayName
|
|
747
|
+
displayName: member.displayName,
|
|
689
748
|
});
|
|
690
749
|
}
|
|
691
750
|
res.json({ error: "Member not found" });
|
|
@@ -699,26 +758,27 @@ function dashboard(client, options) {
|
|
|
699
758
|
const guild = client.guilds.cache.get(req.params.guildId);
|
|
700
759
|
if (!guild) return res.json({ members: [] });
|
|
701
760
|
|
|
702
|
-
const query = (req.query.q ||
|
|
761
|
+
const query = (req.query.q || "").toLowerCase();
|
|
703
762
|
if (query.length < 2) return res.json({ members: [] });
|
|
704
763
|
|
|
705
764
|
try {
|
|
706
765
|
// Ų¬ŁŲØ Ų§ŁŲ£Ų¹Ų¶Ų§Ų” Ł
Ł Ų§ŁŁŲ§Ų“
|
|
707
766
|
const members = guild.members.cache
|
|
708
|
-
.filter(
|
|
709
|
-
m
|
|
710
|
-
|
|
711
|
-
|
|
767
|
+
.filter(
|
|
768
|
+
(m) =>
|
|
769
|
+
m.user.username.toLowerCase().includes(query) ||
|
|
770
|
+
m.displayName.toLowerCase().includes(query) ||
|
|
771
|
+
m.user.id.includes(query)
|
|
712
772
|
)
|
|
713
773
|
.first(20)
|
|
714
|
-
.map(m => ({
|
|
774
|
+
.map((m) => ({
|
|
715
775
|
id: m.user.id,
|
|
716
776
|
username: m.user.username,
|
|
717
777
|
displayName: m.displayName,
|
|
718
778
|
avatar: m.user.avatar,
|
|
719
|
-
discriminator: m.user.discriminator
|
|
779
|
+
discriminator: m.user.discriminator,
|
|
720
780
|
}));
|
|
721
|
-
|
|
781
|
+
|
|
722
782
|
res.json({ members });
|
|
723
783
|
} catch (e) {
|
|
724
784
|
res.json({ members: [], error: e.message });
|
|
@@ -759,7 +819,14 @@ function dashboard(client, options) {
|
|
|
759
819
|
if (level > 0) existing.level = level;
|
|
760
820
|
await existing.save();
|
|
761
821
|
} else {
|
|
762
|
-
await Level.create({
|
|
822
|
+
await Level.create({
|
|
823
|
+
guildId,
|
|
824
|
+
userId,
|
|
825
|
+
totalXP: xp,
|
|
826
|
+
level: level || 0,
|
|
827
|
+
text: 0,
|
|
828
|
+
voice: 0,
|
|
829
|
+
});
|
|
763
830
|
}
|
|
764
831
|
return res.json({ success: true });
|
|
765
832
|
}
|
|
@@ -801,8 +868,13 @@ function dashboard(client, options) {
|
|
|
801
868
|
|
|
802
869
|
try {
|
|
803
870
|
if (Level) levelCount = await Level.countDocuments({ guildId: guild.id });
|
|
804
|
-
if (giveaway)
|
|
805
|
-
|
|
871
|
+
if (giveaway)
|
|
872
|
+
giveawayCount = await giveaway.countDocuments({
|
|
873
|
+
guildId: guild.id,
|
|
874
|
+
ended: false,
|
|
875
|
+
});
|
|
876
|
+
if (Blacklist)
|
|
877
|
+
blacklistCount = await Blacklist.countDocuments({ guild: guild.id });
|
|
806
878
|
} catch (e) {
|
|
807
879
|
console.error("Stats error:", e);
|
|
808
880
|
}
|
|
@@ -824,7 +896,7 @@ function dashboard(client, options) {
|
|
|
824
896
|
});
|
|
825
897
|
|
|
826
898
|
// ŲŖŲ“ŲŗŁŁ Ų§ŁŲ®Ų§ŲÆŁ
|
|
827
|
-
app.listen(
|
|
899
|
+
app.listen(port, () => {});
|
|
828
900
|
|
|
829
901
|
return app;
|
|
830
902
|
}
|
package/function/function.js
CHANGED
|
@@ -490,7 +490,7 @@ async function CreateComponents(type, components) {
|
|
|
490
490
|
selectMenu.addOptions(selectOptions);
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
if (
|
|
493
|
+
if (menu_type === "channel" && Array.isArray(channelTypes)) {
|
|
494
494
|
selectMenu.setChannelTypes(channelTypes);
|
|
495
495
|
}
|
|
496
496
|
|
|
@@ -503,7 +503,7 @@ async function CreateComponents(type, components) {
|
|
|
503
503
|
if (type === "container") {
|
|
504
504
|
result.addActionRowComponents(menu);
|
|
505
505
|
} else {
|
|
506
|
-
result.push(
|
|
506
|
+
result.push(menu);
|
|
507
507
|
}
|
|
508
508
|
} else if (item.type === "section") {
|
|
509
509
|
const section = new SectionBuilder();
|
package/handler/helper.js
CHANGED
|
@@ -6,7 +6,6 @@ const fs = require("fs");
|
|
|
6
6
|
const axios = require("axios");
|
|
7
7
|
const { dashboard } = require("../function/dash");
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
async function cooldowns(client, name, time, user) {
|
|
11
10
|
const cooldownKey = `${name}_${user.id}`;
|
|
12
11
|
const now = Date.now();
|
|
@@ -92,7 +91,7 @@ async function terminalInfo(client, options, data) {
|
|
|
92
91
|
[rowColors[5]("Slash Commands"), rowColors[5](data.slash)],
|
|
93
92
|
[rowColors[6]("Total Commands"), rowColors[6](data.slash + data.prefix)],
|
|
94
93
|
[rowColors[7]("Events"), rowColors[7](data.events)],
|
|
95
|
-
[rowColors[8]("Started At"), rowColors[8](new Date().toLocaleString())]
|
|
94
|
+
[rowColors[8]("Started At"), rowColors[8](new Date().toLocaleString())],
|
|
96
95
|
);
|
|
97
96
|
|
|
98
97
|
secondTable.push(
|
|
@@ -100,7 +99,7 @@ async function terminalInfo(client, options, data) {
|
|
|
100
99
|
[
|
|
101
100
|
rowColors[1]("Bot Invite"),
|
|
102
101
|
rowColors[1](
|
|
103
|
-
`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`,
|
|
104
103
|
),
|
|
105
104
|
],
|
|
106
105
|
[
|
|
@@ -114,9 +113,9 @@ async function terminalInfo(client, options, data) {
|
|
|
114
113
|
? Array.isArray(options.Status.activities)
|
|
115
114
|
? options.Status.activities[0]
|
|
116
115
|
: options.Status.activities
|
|
117
|
-
: "Not Defined"
|
|
116
|
+
: "Not Defined",
|
|
118
117
|
),
|
|
119
|
-
]
|
|
118
|
+
],
|
|
120
119
|
);
|
|
121
120
|
|
|
122
121
|
if (options.database?.url) {
|
|
@@ -126,26 +125,22 @@ async function terminalInfo(client, options, data) {
|
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
let dashTable
|
|
128
|
+
let dashTable;
|
|
130
129
|
if (options.dashboard) {
|
|
131
|
-
|
|
132
|
-
await dashboard(client, options.dashboard);
|
|
130
|
+
await dashboard(client, options.dashboard);
|
|
133
131
|
const port = options.dashboard?.port || 3000;
|
|
134
|
-
|
|
132
|
+
dashTable = new Table({
|
|
135
133
|
head: [chalk.bold.cyan("š Dashboard"), chalk.bold.green("š Value")],
|
|
136
134
|
colWidths: [25, 45],
|
|
137
135
|
});
|
|
138
136
|
|
|
139
|
-
|
|
140
137
|
dashTable.push(
|
|
141
138
|
[rowColors[0]("Status"), rowColors[0]("ā
Online")],
|
|
142
139
|
[rowColors[1]("URL"), rowColors[1](`http://localhost:${port}`)],
|
|
143
140
|
[rowColors[2]("Port"), rowColors[2](port)],
|
|
144
|
-
[rowColors[3]("Version"), rowColors[3]("v2.0.0")]
|
|
141
|
+
[rowColors[3]("Version"), rowColors[3]("v2.0.0")],
|
|
145
142
|
);
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
143
|
+
}
|
|
149
144
|
|
|
150
145
|
console.log(chalk.bold.green("\nā
Bot Information:\n"));
|
|
151
146
|
console.log(firstTable.toString());
|
|
@@ -154,18 +149,19 @@ async function terminalInfo(client, options, data) {
|
|
|
154
149
|
console.log(secondTable.toString());
|
|
155
150
|
|
|
156
151
|
if (options.dashboard) {
|
|
157
|
-
|
|
152
|
+
console.log(chalk.bold.cyan("\nš Dashboard Information:\n"));
|
|
158
153
|
console.log(dashTable.toString());
|
|
159
154
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
155
|
}
|
|
164
156
|
|
|
165
|
-
async function data_conecter(
|
|
157
|
+
async function data_conecter(options) {
|
|
166
158
|
try {
|
|
167
159
|
const mongoose = require("mongoose");
|
|
168
|
-
|
|
160
|
+
const connectOptions = {};
|
|
161
|
+
if (options.dbName) {
|
|
162
|
+
connectOptions.dbName = options.dbName;
|
|
163
|
+
}
|
|
164
|
+
await mongoose.connect(options.url, connectOptions);
|
|
169
165
|
return true;
|
|
170
166
|
} catch (error) {
|
|
171
167
|
console.error("ā Failed to connect to the database:", error);
|
|
@@ -222,8 +218,6 @@ async function set_anticrash(data) {
|
|
|
222
218
|
process.on("warning", (error) => send(error, "warn"));
|
|
223
219
|
}
|
|
224
220
|
|
|
225
|
-
|
|
226
|
-
|
|
227
221
|
async function cmd_log(client, data, commandName, channelId) {
|
|
228
222
|
const isSlash = !!data.user;
|
|
229
223
|
const user = isSlash ? data.user : data.author;
|
|
@@ -231,12 +225,10 @@ async function cmd_log(client, data, commandName, channelId) {
|
|
|
231
225
|
const logChannel = client.channels.cache.get(channelId);
|
|
232
226
|
if (!logChannel) return;
|
|
233
227
|
|
|
234
|
-
|
|
235
228
|
let messageLink = "Unknown";
|
|
236
229
|
try {
|
|
237
230
|
if (isSlash) {
|
|
238
|
-
|
|
239
|
-
const reply = await data.fetchReply()
|
|
231
|
+
const reply = await data.fetchReply();
|
|
240
232
|
if (reply) {
|
|
241
233
|
messageLink = `https://discord.com/channels/${data.guild.id}/${data.channel.id}/${reply.id}`;
|
|
242
234
|
}
|
|
@@ -276,9 +268,10 @@ async function cmd_log(client, data, commandName, channelId) {
|
|
|
276
268
|
{ name: "\u200B", value: "\u200B", inline: true },
|
|
277
269
|
{
|
|
278
270
|
name: "š Message:",
|
|
279
|
-
value:
|
|
271
|
+
value:
|
|
272
|
+
messageLink !== "Unknown" ? `- [Link](${messageLink})` : "Not found",
|
|
280
273
|
inline: true,
|
|
281
|
-
}
|
|
274
|
+
},
|
|
282
275
|
);
|
|
283
276
|
} else {
|
|
284
277
|
fields.push({
|
|
@@ -288,7 +281,6 @@ async function cmd_log(client, data, commandName, channelId) {
|
|
|
288
281
|
});
|
|
289
282
|
}
|
|
290
283
|
|
|
291
|
-
|
|
292
284
|
if (!isSlash && data.content) {
|
|
293
285
|
fields.push({
|
|
294
286
|
name: "š Content:",
|
|
@@ -301,7 +293,6 @@ async function cmd_log(client, data, commandName, channelId) {
|
|
|
301
293
|
value: `<t:${Math.floor(Date.now() / 1000)}:F>`,
|
|
302
294
|
});
|
|
303
295
|
|
|
304
|
-
|
|
305
296
|
const embed = new EmbedBuilder()
|
|
306
297
|
.setTitle(isSlash ? "š Slash Command Log" : "š Prefix Command Log")
|
|
307
298
|
.setColor(isSlash ? "Blue" : "Green")
|
|
@@ -311,7 +302,10 @@ async function cmd_log(client, data, commandName, channelId) {
|
|
|
311
302
|
name: `${user?.tag ?? "Unknown user"} || ${user?.username ?? "Unknown"}`,
|
|
312
303
|
iconURL: user?.displayAvatarURL({ dynamic: true }),
|
|
313
304
|
})
|
|
314
|
-
.setFooter({
|
|
305
|
+
.setFooter({
|
|
306
|
+
text: "Command Logger",
|
|
307
|
+
iconURL: client.user.displayAvatarURL(),
|
|
308
|
+
})
|
|
315
309
|
.setTimestamp();
|
|
316
310
|
|
|
317
311
|
try {
|
|
@@ -321,21 +315,17 @@ async function cmd_log(client, data, commandName, channelId) {
|
|
|
321
315
|
}
|
|
322
316
|
}
|
|
323
317
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
318
|
//////////////////////////////////* Check update š¼
|
|
328
319
|
|
|
329
320
|
async function update(client, id, webhookURL) {
|
|
330
321
|
const { version, note: localNote } = require("../package.json");
|
|
331
322
|
|
|
332
323
|
const { data } = await axios.get(
|
|
333
|
-
`https://registry.npmjs.org/djs-builder/latest
|
|
324
|
+
`https://registry.npmjs.org/djs-builder/latest`,
|
|
334
325
|
);
|
|
335
326
|
const new_version = data.version;
|
|
336
327
|
const note = data.note || "";
|
|
337
328
|
|
|
338
|
-
|
|
339
329
|
if (
|
|
340
330
|
client.djs_builder_version &&
|
|
341
331
|
client.djs_builder_version === new_version
|
|
@@ -346,8 +336,8 @@ async function update(client, id, webhookURL) {
|
|
|
346
336
|
if (new_version !== version) {
|
|
347
337
|
console.log(
|
|
348
338
|
chalk.yellow(
|
|
349
|
-
`ā ļø New version available: ${new_version} (Your version: ${version})
|
|
350
|
-
)
|
|
339
|
+
`ā ļø New version available: ${new_version} (Your version: ${version})`,
|
|
340
|
+
),
|
|
351
341
|
);
|
|
352
342
|
|
|
353
343
|
const crash = new WebhookClient({ url: webhookURL });
|
|
@@ -355,7 +345,7 @@ async function update(client, id, webhookURL) {
|
|
|
355
345
|
const embed = new EmbedBuilder()
|
|
356
346
|
.setTitle("š New version available")
|
|
357
347
|
.setDescription(
|
|
358
|
-
`${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. ā¤`,
|
|
359
349
|
)
|
|
360
350
|
.setColor("Yellow")
|
|
361
351
|
.setTimestamp();
|
package/handler/starter.js
CHANGED
|
@@ -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.
|
|
4
|
-
"note": "š Package Update v0.7.
|
|
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": {
|