apexify.js 2.4.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +4 -710
  2. package/dataSQL/data.sql +5 -0
  3. package/dataSQL/dataName.sql +0 -0
  4. package/dataSQL/example_table.sql +1 -0
  5. package/index.js +3 -78
  6. package/lib/ai/apexAI.js +2 -2
  7. package/lib/{discord/events/handler → ai/buttons}/tools.js +1 -1
  8. package/lib/utils.js +2 -72
  9. package/package.json +2 -81
  10. package/lib/canvas/themes/level ara.ttf +0 -0
  11. package/lib/canvas/themes/levelFont.ttf +0 -0
  12. package/lib/canvas/themes/levels-card.js +0 -884
  13. package/lib/canvas/themes/music-card.js +0 -342
  14. package/lib/canvas/themes/numbers.ttf +0 -0
  15. package/lib/canvas/themes/tajawal.ttf +0 -0
  16. package/lib/database/MongoDB.js +0 -126
  17. package/lib/database/NanoDB.js +0 -1341
  18. package/lib/database/mongoDb/aggregate.js +0 -120
  19. package/lib/database/mongoDb/countDocs.js +0 -115
  20. package/lib/database/mongoDb/createCollection.js +0 -125
  21. package/lib/database/mongoDb/dataSize.js +0 -89
  22. package/lib/database/mongoDb/distinct.js +0 -110
  23. package/lib/database/mongoDb/drop.js +0 -76
  24. package/lib/database/mongoDb/find.js +0 -122
  25. package/lib/database/mongoDb/geoNear.js +0 -91
  26. package/lib/database/mongoDb/index.js +0 -71
  27. package/lib/database/mongoDb/listCollections.js +0 -81
  28. package/lib/database/mongoDb/migrateAndPrune.js +0 -89
  29. package/lib/database/mongoDb/migrateData.js +0 -79
  30. package/lib/database/mongoDb/remove.js +0 -73
  31. package/lib/database/mongoDb/removeMany.js +0 -73
  32. package/lib/database/mongoDb/removeManyExcept.js +0 -91
  33. package/lib/database/mongoDb/removeSpecific.js +0 -93
  34. package/lib/database/mongoDb/save.js +0 -94
  35. package/lib/database/mongoDb/searchMany.js +0 -109
  36. package/lib/database/mongoDb/textSearch.js +0 -88
  37. package/lib/database/mongoDb/updateAll.js +0 -80
  38. package/lib/database/mongoDb/updateAllExcept.js +0 -108
  39. package/lib/database/mongoDb/updateData.js +0 -106
  40. package/lib/database/nanoDb/fetchData.js +0 -39
  41. package/lib/database/nanoDb/removeField.js +0 -46
  42. package/lib/database/nanoDb/saveData.js +0 -68
  43. package/lib/database/nanoDb/updateFilter.js +0 -24
  44. package/lib/database/ready-schemas.js +0 -245
  45. package/lib/database/utils.js +0 -58
  46. package/lib/discord/discord-build/commands-(prefix)/music/functions/buttons.js +0 -361
  47. package/lib/discord/discord-build/commands-(prefix)/music/functions/end.js +0 -58
  48. package/lib/discord/discord-build/commands-(prefix)/music/functions/start.js +0 -115
  49. package/lib/discord/discord-build/commands-(prefix)/music/play.js +0 -152
  50. package/lib/discord/discord-build/commands-(prefix)/music/previous.js +0 -82
  51. package/lib/discord/discord-build/commands-(prefix)/music/resume.js +0 -93
  52. package/lib/discord/discord-build/commands-(prefix)/music/skip.js +0 -82
  53. package/lib/discord/discord-build/commands-(prefix)/music/stop.js +0 -79
  54. package/lib/discord/discord-build/components/buttons.js +0 -75
  55. package/lib/discord/discord-build/components/menus.js +0 -81
  56. package/lib/discord/discord-build/components/paginator.js +0 -156
  57. package/lib/discord/discord-build/components/permsChecker.js +0 -81
  58. package/lib/discord/discord-build/levelingSystem/cLevel.js +0 -829
  59. package/lib/discord/discord-build/levelingSystem/cLevelsArray.json +0 -104
  60. package/lib/discord/discord-build/utils.js +0 -23
  61. package/lib/discord/events/eventer.js +0 -145
  62. package/lib/discord/events/prefixRegister.js +0 -148
  63. package/lib/discord/events/prefixResponder.js +0 -163
  64. package/lib/discord/events/slashRegister.js +0 -183
  65. package/lib/discord/events/slashResponder.js +0 -108
  66. package/lib/discord/events/starter.js +0 -441
  67. package/lib/discord/functions/perms.js +0 -19
  68. package/lib/discord/utils.js +0 -6
  69. package/lib/general-functions/discord/typeWriter.js +0 -77
  70. package/lib/general-functions/utils.js +0 -19
  71. /package/lib/{discord/events/handler → ai/buttons}/drawMenu.js +0 -0
package/README.md CHANGED
@@ -9,88 +9,13 @@ Greetings everyone! 🌟 This marks the release of a beta version for our packag
9
9
 
10
10
  - New chat models has been added (starChat, zephyr-beta, gemma-v and v4)
11
11
 
12
- - Leveling system (customizable with new features and themes using canvas)
13
-
14
- - Our [Server Support](https://discord.gg/FsmKSmxJjD)
15
- </details>
16
-
17
-
18
- # 🚀 Getting Started
19
- <details>
20
-
21
- - If you're new and facing issues or unable to register and execute commands (slash / prefix).
22
- - Use the code snippet below (Note: This may slightly increase bot latency by approximately 50ms).
23
- ```javascript
24
- const { Client, GatewayIntentBits, Partials } = require("discord.js");
25
- const { starter } = require('apexify.js');
26
- const path = require('path');
27
-
28
- const client = new Client({
29
- intents: Object.keys(GatewayIntentBits).map((a)=>{
30
- return GatewayIntentBits[a]
31
- }),
32
- partials: Object.values(Partials),
33
- });
34
-
35
- const token = process.env.token;
36
- const eventsPath = path.join(__dirname, 'src', 'events');
37
- const prefixCommandPath = path.join(__dirname, 'src', 'prefix');
38
-
39
- const options = {
40
- token: toekn,
41
- status: 'online', // idle, online, dnd
42
- name: 'Playing with commands',
43
- type: 0, // type is for activity (Playing, Watching, Custom , Listening, etc.)
44
- botName: 'tools', // bot name
45
- botAvatar: './pfp.jpeg', // set your bot avatar as a URL or local file (GIF also works)
46
- botBanner: 'url or path', // set your bot banner
47
- eventsPath,
48
-
49
- // Note: Don't provide guildId or put it in the options if you set global as true
50
- slashCommandPath: {
51
- baseDir: __dirname, // need to be provided to read your commands path
52
- path: './src/slash',
53
- global: true, // true for making slash commands global
54
- guildId: '', // guild if global is false
55
- logsId: '', // channel ID for commands log
56
- },
57
- prefixCommandPath: {
58
- path: prefixCommandPath, // your prefix commands path
59
- logsId: '', // channel ID for commands log
60
- prefix: '!', // prefix of the bot
61
- },
62
- lavalink: {
63
- // Lavalink configuration for music
64
- nodes: [],
65
- search: 'ytmsearch', // (ytmsearch) => YouTube musics || (spsearch) => Spotify musics
66
- version: 'v4', // your Lavalink version
67
- },
68
- mongo: {
69
- mongoURI: '', // Your MongoDB URI for connecting to MongoDB
70
- dataName: '', // Your Database name to create in MongoDB
71
- },
72
- webView: {///creating aport using express
73
- port: 3000,
74
- hostname: 'jedi-studio.com',
75
- middleware: ,
76
- routs:
77
- },
78
- anticrash: {
79
- enabled: true,
80
- webhookURL: '', /// Your discord webhook url
81
- userToMention: '', /// userId to notify him by the errors
82
- autoFix: false, /// # WARNING: Don't enable this option it is broke.. soon updates it will fix anticrash error automatically
83
- }
84
- };
85
-
86
- starter(client, options);
87
- ```
12
+ - Our [Server Support](https://discord.gg/MbrvstwNjs)
88
13
  </details>
89
14
 
90
15
 
91
16
  # 🚀 Usage Guidelines
92
17
 
93
- ## 🤖 Ai Chat & Imagine
18
+ ### 🤖 Ai Chat & Imagine
94
19
  <details>
95
20
 
96
21
  - **Added new chat models**
@@ -255,401 +180,6 @@ module.exports = {
255
180
  </details>
256
181
  </details>
257
182
 
258
- ## 📈 Leveling-System 🌠
259
-
260
- <details>
261
-
262
- - Note: ** This system uses mongoDb as database you need to ensure connection is made before using it**. You can make your own connection to mongodb or use mongoConnect funciton which is exported from apexify.js.
263
-
264
- ```js
265
- const { LevelingSystem } = require('apexify.js');
266
- const level_system = new LevelingSystem({
267
- XpCount: 15, // Each message is equalt to how many xp (1 message = 15xp)
268
- rate: 2, // Rate message multiplier 1 message * 2 so 30xp per each msg
269
- channelId: '1212829696358875196', // Channel Id to send in it level up messages
270
- guildId: '1206054171657375754', // Your serverId
271
- levelingMessage:'Congrates {user} you level up to level {level}.', // Leveling up message
272
- levelsArray: [ // You can use your own levels system or leave it empty array and it will use the deffaut one which is inside the pkg inbuilt
273
- { level: 0, xpCount: 0 },
274
- { level: 1, xpCount: 10 },
275
- { level: 2, xpCount: 50 },
276
- { level: 3, xpCount: 75 },
277
- { level: 4, xpCount: 100 },
278
- { level: 5, xpCount: 150 },
279
- { level: 6, xpCount: 200 },
280
- { level: 7, xpCount: 300 },
281
- { level: 8, xpCount: 400 },
282
- { level: 9, xpCount: 500 },
283
- { level: 10, xpCount: 700 },
284
- { level: 11, xpCount: 900 },
285
- { level: 12, xpCount: 1200 },
286
- { level: 13, xpCount: 1500 },
287
- { level: 14, xpCount: 1800 },
288
- { level: 15, xpCount: 2200 },
289
- { level: 16, xpCount: 2600 },
290
- { level: 17, xpCount: 3000 },
291
- { level: 18, xpCount: 3500 },
292
- { level: 19, xpCount: 4000 },
293
- { level: 20, xpCount: 4500 },
294
- { level: 21, xpCount: 5000 },
295
- { level: 22, xpCount: 6000 },
296
- { level: 23, xpCount: 7000 },
297
- { level: 24, xpCount: 8000 },
298
- { level: 25, xpCount: 9000 },
299
- { level: 26, xpCount: 10000 },
300
- { level: 27, xpCount: 12000 },
301
- { level: 28, xpCount: 14000 },
302
- { level: 29, xpCount: 16000 },
303
- { level: 30, xpCount: 20000 },
304
- ],
305
- });
306
-
307
-
308
- /// Using level system inside messageCreate event
309
-
310
- client.on('messageCreate', async (m) => {
311
- const userId = m.author.id;
312
- const guild = m.guild;
313
- try {
314
- await level_system.setupConfig() /// saving data above into mongodb
315
-
316
- await level_system.addXp(userId, guild.id); /// adding xp to the user on each msg sent
317
-
318
- await level_system.disableLevel(guild.id); /// remove/disable leveling system for the current server (note this will delete server data)
319
-
320
- const card = await level_system.xpCard(m, guild.id, userId);// display a leveling card user rank and his current xp
321
- m.reply({ files: [card] });
322
-
323
- await level_system.setUserBanner(guild.id, userId); // set user banner in the xpCard
324
-
325
- const userData = await level_system.userInfo(guild.id, userId); // returns user data (xp, level, userId, bannerURL)
326
- console.log(userData);
327
-
328
- const serverData = await level_system.checkConfig(guild.id);
329
- console.log(serverData); // returns (serverid, channelId, xpCount, rate, levelsArray, levelUpmessage)
330
-
331
-
332
- const topusers = await level_system.serverLeaderBoard(guild.id, '20'); // 20 is the number of user to be displayed for example top 20
333
- console.log(topusers); // returns top 20 users in order from highest to lowest
334
-
335
- const topGlobal = await level_system.topGlobal('10'); // top 10
336
- console.log(topGlobal); // Returns each user in order with data displayment for each
337
-
338
- /// levelup event to send level up card once user moves to the next level
339
- level_system.on('levelup', async (levelupmsg, userId, userlevel, userXp, channelId, guildId) => {
340
- const guild = message.client.guilds.cache.get(guildId);
341
- const channel = guild.channels.cache.get(channelId);
342
- const card = await level_system.levelUpCard(message, userId, guildId);
343
- await channel.send({ files: [card] })
344
- });
345
-
346
- const editXp = await level_system.editXp(guild.id, userId, xpAmount); // The xpAmount to add or to remove from the useer
347
- console.log(editXp); // returns new xp and level of the user
348
-
349
-
350
- const removeUser = await level_system.removeUser(guild.id, userId); // remove the user from data
351
-
352
- const serverleaderboard = await level_system.serverLeaderBoardCard(m, guildId, version = 1 or 2, 'set usernames color or put word random');
353
- m.reply({ files: [card] });
354
-
355
- await level_system.liveServerLeaderboard(m, guild.id, 'channel id to set the live leaderboard at', 20000, 1); /// 20000 is the uodate timer for live duration keep it more than 10 seconds and number 1 is the version of the live board either user 1 or 2
356
- } catch (error) {
357
- console.error(error.message);
358
- }
359
-
360
- });
361
-
362
- ```
363
-
364
- </details>
365
-
366
- ## 📊 Database MongoDb (Online) 📁
367
- <details>
368
-
369
- - To connect to MongoDB/Mongoose, provide your URL and name your database. Follow these steps:
370
-
371
- ```js
372
- ///for cjs module (.cjs/.js)
373
- const { mongoConnect } = require('apexify.js');
374
- ///for es module (.mjs/(.js if "type": "module" in package.json) or ts
375
- import { mongoConnect } from 'apexify.js';
376
-
377
- // Connect to MongoDB
378
- const mongoSuccess = await mongoConnect('mongoURI', 'dbName');
379
-
380
- // Access connected databases using getDb functions
381
- const mongoDb = await getDb();
382
-
383
- /*----------------------------------------*/
384
- //if you wanted to use your database to save/edit/delete then use this example below
385
-
386
- // Example usage:
387
-
388
- const { save, updateData, find, remove, removeSpecific } = require('apexify.js');
389
-
390
-
391
- ///# Save (insertOne)
392
- const collectionName = 'exampleCollection';
393
- const document = { key: 'value' };
394
- const options = {
395
- uniqueFields: ['key'], // Example unique field
396
- };
397
- // Saving the document to MongoDB with options
398
- const savedDocument = await save(collectionName, document, options);
399
-
400
-
401
- ///# Find (findOne)
402
- const collectionName = 'exampleCollection';
403
- const filter = { _id: '6063b0f4e8e8b652780e97e0' }; // Example filter, you can customize it
404
- const projection = { name: 1, age: 1 }; // Example projection, you can customize it
405
- const options = {
406
- sort: { age: -1 }, // Example sort option, you can customize it
407
- limit: 5, // Example limit option, you can customize it
408
- };
409
- // Finding a document in MongoDB with options
410
- const foundDocument = await find(collectionName, filter, projection, options);
411
-
412
-
413
- ///# SearchMany (find().toArray)
414
- const collectionFilters = [
415
- { collectionName: 'collection1', displayment: 5, filter: { status: 'active' } },
416
- { collectionName: 'collection2', displayment: null, filter: { type: 'public' } },
417
- // Add more collection filters as needed to search for
418
- ];
419
- // Searching for documents in multiple collections with specific filters
420
- const searchResults = await searchMany(collectionFilters);
421
-
422
-
423
- ///# Remove (deleteOne)
424
- const collectionName = 'exampleCollection';
425
- const filter = { _id: '6063b0f4e8e8b652780e97e0' }; // Example filter, you can customize it
426
- // Removing a document from MongoDB
427
- const removalResult = await remove(collectionName, filter);//remove the document which mathces the filter
428
-
429
-
430
- ///# RemoveSpecific (deleteOne(filter))
431
- const collectionName = 'exampleCollection';
432
- const filter = { _id: '6063b0f4e8e8b652780e97e0', name: 'John Doe' }; // Example filter, you can customize it
433
- const keyToRemove = { name: 1 }; // Example key to remove, you can customize it
434
- // Removing a document from MongoDB with specific keys removed
435
- const removalResult = await removeSpecific(collectionName, filter, keyToRemove);//remove the key without remvoe the full document
436
-
437
-
438
- ///# RemoveMany (deleteMany)
439
- const collectionName = 'exampleCollection';
440
- const filter = { status: 'inactive' }; // Example filter, you can customize it
441
- // Removing multiple documents from MongoDB based on a filter
442
- const removalResult = await removeMany(collectionName, filter);
443
-
444
-
445
- ///# UpdateData (updateOne)
446
- const collectionName = 'yourCollectionName'; // Replace with your actual collection name
447
- const filter = { _id: 'yourDocumentId', age: 23, name: 'Elias' }; // Replace with your actual filter criteria
448
- const update = { age: 19, gender: 'male' }; // Replace with your actual update data
449
- const uniqueFields = ['field1', 'field2']; // Replace with your unique fields, if any!
450
- // Updating document data in the specified collection
451
- const updateResult = await updateData(collectionName, filter, update, uniqueFields);
452
-
453
-
454
- ///# UpdateAll (updateMany)
455
- const collectionName = 'yourCollectionName'; // Replace with your actual collection name
456
- const filter = { level: 20, serverId: guildId, userId: userId }; // Replace with your actual filter criteria
457
- const update = { level: 31 }; // Replace with your actual update data
458
- const uniqueFields = ['userId', 'serverId']; // Replace with your unique fields, if any!
459
- // Updating all documents matching the filter in the specified collection
460
- const updateResult = await updateAll(collectionName, filter, update, options);
461
-
462
-
463
- ///# MigrateData
464
- const sourceCollection = 'yourSourceCollection'; // Replace with your actual source collection name
465
- const destinationCollection = 'yourDestinationCollection'; // Replace with your actual destination collection name
466
- // Transferring data from the source collection to the destination collection
467
- const transferResult = await migrateData(sourceCollection, destinationCollection);
468
-
469
-
470
- ///# MigrateAndPrune
471
- const sourceCollection = 'yourSourceCollection'; // Replace with your actual source collection name
472
- const destinationCollection = 'yourDestinationCollection'; // Replace with your actual destination collection name
473
- // Transferring data from the source collection to the destination collection
474
- const transferResult = await migrateAndPrune(sourceCollection, destinationCollection);
475
-
476
-
477
- ///# Drop (drop)
478
- const dropCollectiom = 'collectionToRemove'; // Replace with your actual collection name
479
- // Removing collection from mongoDb
480
- const dropResults = await drop(dropCollectiom);
481
-
482
-
483
- ///# DataSize
484
- const dataToCheck = 'collectioNameToCheck'; // Replace with your actual collection name
485
- // Check collection size in db
486
- const size = await dataSize(dataToCheck);
487
- ```
488
- </details>
489
-
490
- ## 📊 Database NanoDb (local) 📁
491
- <details>
492
-
493
- - NanoDb is specially made for apexify library to make database easy for all (json database)
494
-
495
- ```js
496
- ///for cjs module (.cjs/.js)
497
- const { NanoDb } = require('apexify.js');
498
- ///for es module (.mjs/(.js if "type": "module" in package.json) or ts
499
- import { NanoDb } from 'apexify.js';
500
-
501
- /// Setting Which data json to configure
502
- const db = await NanoDb('path/file/to/json'); // Example: ../data.json
503
-
504
-
505
- ///# AddOne (inserting new data)
506
- const result = await db.addOne({ userId: , serverId: , name: , age: 27}, { uniqueKeys: ['userId', 'serverId'] });
507
- console.log(result)
508
-
509
-
510
- ///# FindData (search for single document)
511
- const result = await db.findData({ username: 'john', age: 40 });
512
- console.log(result)
513
-
514
-
515
- ///# DisplayData (display data array)
516
- const displayOptions = {
517
- displayment: 10,//display how many documents
518
- filters: {
519
- country: 'usa'///your filter
520
- },
521
- page: 1,
522
- pageSize: 10,
523
- sortBy: 'size', // Replace with the actual field you want to sort by
524
- sortOrder: 'asc', // or 'desc' asc => ascending, desc => descending
525
- };
526
-
527
- // Displaying data using the displayData method
528
- const result = await db.displayData(displayOptions);
529
- console.log(result)
530
-
531
-
532
- ///# RemoveOne (remove a single key from single document)
533
- const filterQuery = {
534
- xp: 1000 => assign it 'any' if you dont have specific value
535
- };
536
-
537
- const removeFilter = {
538
- level: 'any'
539
- };
540
- // Removing fields using the removeOne method
541
- const result = await db.removeOne(filterQuery, removeFilter);
542
- console.log(result)
543
-
544
-
545
- ///# RemoveDoc (remove a a full document)
546
- const result = await db.removeDoc({ userId: value, serverId: value });
547
- console.log(result)
548
-
549
-
550
- ///# UpdatData (update a single document in the json)
551
- const result = await db.updateData({ userId: value, validate: value}, { validate: newValue });
552
- console.log(result)
553
-
554
-
555
- ///# UpdateMany (update a many documents in the json)
556
- const result = await db.updateMany({ validate: value, session: value }, { session: newvalue });
557
- console.log(result)
558
-
559
-
560
- ///# Drop (remove whole data in json)
561
- const result = await db.drop();
562
- console.log(result)
563
-
564
-
565
- ///# Aggregate
566
- const aggregationPipeline = [
567
- {
568
- $group: {
569
- _id: '$serverId', // Group by serverId
570
- totalWallet: { $sum: '$wallet' }, // Calculate total wallet amount within each serverId
571
- totalBank: { $sum: { $ifNull: ['$bank', 0] } }, // Calculate total bank amount (considering null values)
572
- uniqueUsers: { $addToSet: '$unique.userId' }, // Create a set of unique user IDs within each serverId
573
- },
574
- },
575
- ];
576
-
577
- // Use the aggregate method to execute the pipeline
578
- db.aggregate(aggregationPipeline)
579
- .then((result) => {
580
- console.log(result.aggregatedResults[0].$serverId);
581
- })
582
- .catch((error) => {
583
- console.error(error);
584
- });
585
-
586
-
587
- ///# TransferData (moving data from json to another)
588
- const transferResult = await db.transferData('./output.json');
589
-
590
- ///# DistinctData (Displayd data fields for the query)
591
- const distinctResult = await db.distinct('id');
592
- //log results: ['232', '4234', '2342']
593
- console.log(distinctResult)
594
-
595
-
596
- ///# IndexData
597
- // Access data from the NanoDb instance
598
- const existingData = await db.dataPromise;
599
-
600
- // Iterate through each data point and create indexes
601
- existingData.forEach((data) => {
602
- db.indexData(data);
603
- });
604
-
605
- // Now you can access the indexes
606
- // For example, let's say you want to retrieve all data with serverId 'A'
607
- const serverAData = db.indexes.get('serverId')?.get('A');
608
- console.log(serverAData)
609
-
610
-
611
- ///# SearchTeaxt (search in values of the keys in json)
612
- const searchQuery = '3423411305833931769200953'; // Key value for userId
613
- const searchResults = await db.fullTextSearch(searchQuery);
614
- console.log(searchResults)
615
-
616
- ///# NanoSize
617
- const result = await db.nanoSize()
618
- console.log(result)
619
-
620
-
621
- ///# Replicate
622
- const result = await db.replicate('./data.json', '../output.json');
623
- console.log(result)
624
-
625
-
626
- ///# EncryptData
627
- const encryptResult = await db.encrypt('a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6') // Change the key as you like
628
- console.log(ecryptResult)
629
-
630
- ْ
631
- ///# DecryptData
632
- const descryptResult = await db.decryptData('a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6') // Change the key depending on the key you used to encrypt
633
- console.log(descryptResult)
634
-
635
-
636
- ///# BackUp
637
- const filePathToJsonData = './output.json';
638
- const typeOfCompression = 'txt'; // Formates we provide is txt/json/zip/gzip
639
- const outputPath = './lib/done.txt';
640
- const encrypted = false; // Encrypting your backup data
641
- const encryptionKey = 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6';
642
-
643
- const backupOptions = {
644
- outputPath,
645
- encrypted,
646
- key: encrypted ? encryptionKey : undefined,
647
- };
648
-
649
- const backUp = await db.backup(filePathToJsonData, typeOfCompression, backupOptions);
650
- ```
651
- </details>
652
-
653
183
  ## 📸 Manipulating Images Using Canvas 🎨
654
184
  <details>
655
185
  Add images, shapes, and effects to images with ease!
@@ -782,257 +312,21 @@ const textOptionsArray = [
782
312
  ];
783
313
  ///Adding the text on the drawn image before
784
314
  const buffer = await paintImage.addText(textOptionsArray, image, __dirname);
785
-
786
- //sending the buffered image with text on it
787
- await message.channel.send({files: [buffer] });
315
+ console.log(buffer)
788
316
  ```
789
317
  </details>
790
318
 
791
- ## Discord-Build ⚒️
792
- <details>
793
-
794
- - Easy & Simple ways to make buttons & menus & paginator & permschecker
795
-
796
- ```js
797
-
798
- //////MAKE BUTTONS///////
799
-
800
- const { ButtonManager } = require('apexify.js'); ///cjs modules .js
801
-
802
- import { ButtonManager } from 'apexify.js'; /// ejs modules .mjs or ts
803
-
804
- const buttonsData = [
805
- {
806
- customId: 'button1',
807
- style: 'Primary',// style: Primary, Secondary, Link, Danger, Success
808
- label: 'Primary Button',
809
- emoji: '😃', // Emoji for the button
810
- disabled: false, // Whether the button is disabled
811
- },
812
- {
813
- customId: 'button2',
814
- style: 'Secondary',
815
- label: 'Secondary Button',
816
- emoji: '🚀',
817
- disabled: true,
818
- },
819
- {
820
- customId: 'linkButton',
821
- style: 'Link',
822
- label: 'Link Button',
823
- url: 'https://example.com', // URL for link-style button
824
- emoji: '🔗',
825
- },
826
- ];
827
-
828
- // Create an instance of ButtonManager
829
- const buttonManager = new ButtonManager(buttonsData);
830
-
831
- // Create an action row with the buttons
832
- const actionRow = buttonManager.ButtonBuild();
833
-
834
- // Define a message with the action row
835
- message.reply({ content: 'Click the buttons:',
836
- components: [actionRow],
837
- });
838
-
839
- // Define in interaction
840
- interaction.reply({ content: 'Click the buttons:',
841
- components: [actionRow],
842
- });
843
-
844
319
 
845
- //////MAKE MENUS///////
846
-
847
- const { SelectMenuManager } = require('apexify.js');// cjs module .js
848
- import { SelectMenuManager } from 'apexify.js'; // ejs module .mjs or ts
849
-
850
- // Define select menu options
851
- const selectMenuOptions = [
852
- { label: 'Option 1', value: 'option1', description: 'Description for Option 1', emoji: '🌟', default: true },
853
- { label: 'Option 2', value: 'option2', description: 'Description for Option 2', emoji: '🚀' },
854
- { label: 'Option 3', value: 'option3', description: 'Description for Option 3', emoji: '🔗' },
855
- ];
856
-
857
- // Create an instance of SelectMenuManager
858
- const selectMenuManager = new SelectMenuManager(
859
- selectMenuOptions,
860
- 'customSelectMenuId', // Custom ID for the select menu
861
- 'Select an option', // Placeholder text for the select menu
862
- 1, // Minimum number of selected values
863
- 2, // Maximum number of selected values
864
- false // Disabled state for meny (true or false)
865
- );
866
-
867
- // Create a select menu with the specified options
868
- const selectMenuRow = selectMenuManager.createSelectMenu();
869
-
870
- // Define a message with the select menu
871
- message.reply({
872
- content: 'Please choose an option:',
873
- components: [selectMenuRow],
874
- });
875
-
876
- // Define a interaction with the select menu
877
- interaction.reply({
878
- content: 'Please choose an option:',
879
- components: [selectMenuRow],
880
- });
881
-
882
-
883
- ////////MAKE EMBED PAGINATOR////////
884
-
885
- const { Paginator } = require('apexify.js');// cjs module .js
886
- import { Paginator } from 'apexify.js'; // ejs module .mjs or ts
887
-
888
- const pageOptions = [
889
- {
890
- title: 'Page 1',
891
- description: 'Content for Page 1',
892
- color: '#3498db', // Hex color code
893
- authorName: 'Author Name',
894
- authorIcon: 'https://example.com/author-icon.png', // URL to author's icon
895
- footerName: 'Footer Name',
896
- footerIcon: 'https://example.com/footer-icon.png', // URL to footer's icon
897
- image: 'https://example.com/image.png', // URL to image
898
- thumbnail: 'https://example.com/thumbnail.png', // URL to thumbnail
899
- url: 'https://example.com/page-1', // URL for the entire embed
900
- timestamp: true, // Include timestamp
901
- },
902
- {
903
- title: 'Page 2',
904
- description: 'Content for Page 2',
905
- color: '#e74c3c',
906
- authorName: 'Another Author',
907
- authorIcon: 'https://example.com/another-author-icon.png',
908
- footerName: 'Another Footer',
909
- footerIcon: 'https://example.com/another-footer-icon.png',
910
- image: 'https://example.com/another-image.png',
911
- thumbnail: 'https://example.com/another-thumbnail.png',
912
- url: 'https://example.com/page-2',
913
- timestamp: true,
914
- },
915
- {
916
- title: 'Page 3',
917
- description: 'Content for Page 3',
918
- color: '#2ecc71',
919
- authorName: 'Yet Another Author',
920
- authorIcon: 'https://example.com/yet-another-author-icon.png',
921
- footerName: 'Yet Another Footer',
922
- footerIcon: 'https://example.com/yet-another-footer-icon.png',
923
- image: 'https://example.com/yet-another-image.png',
924
- thumbnail: 'https://example.com/yet-another-thumbnail.png',
925
- url: 'https://example.com/page-3',
926
- timestamp: true,
927
- },
928
- // Add more pages as needed
929
- ];
930
-
931
- // Create an instance of the Paginator class
932
- const paginator = new Paginator({ options: pageOptions, timeout: 30000 });
933
-
934
- /// In messages
935
- client.on('messageCreate', async (msg) => {
936
- // Check if the message author is a bot
937
- if (msg.author.bot) return;
938
-
939
- // Send the paginated message when the command !sendPaginator is received
940
- if (msg.content === '!sendPaginator') {
941
- const user = msg.author;
942
- const options = { ownerOnly: false, hidden: false, };
943
-
944
- // Send the paginated message
945
- await paginator.send(msg, user, options);
946
- }
947
- });
948
-
949
-
950
- /// In interactions
951
- client.on('interactionCreate', async (i) => {
952
- // Check if the message author is a bot
953
- if (i.user.bot) return;
954
-
955
- // Send the paginated message when the command/ button is used
956
- if (i.customId === 'button') {
957
- const user = i.user;
958
- const options = { ownerOnly: false, hidden: false, };
959
-
960
- // Send the paginated message
961
- await paginator.send(i, user, options);
962
- }
963
- });
964
-
965
-
966
- //////PERMISSION CHECKER///////
967
-
968
- const { PermissionChecker } = require('apexify.js'); // cjs module .js
969
- import { PermissionChecker } from 'apexify.js'; // ejs module .mjs or ts
970
-
971
-
972
- client.on('messageCreate', async (message) => {
973
- if (message.content.startsWith('!checkPermissions')) {
974
- try {
975
- // Specify the required permissions you want to check
976
- const requiredPermissions = ['KickMembers', 'BanMembers', 'ManageChannels'];
977
-
978
- // Instantiate the PermissionChecker
979
- const permissionChecker = new PermissionChecker();
980
-
981
- // Check if the message author has the required permissions
982
- const hasPermissions = await permissionChecker.checker(message.author.id, message.guild, requiredPermissions);
983
-
984
- if (hasPermissions) {
985
- message.reply('You have the required permissions!');
986
- } else {
987
- message.reply('You do not have the required permissions!');
988
- }
989
- } catch (error) {
990
- console.error('Error:', error.message);
991
- }
992
- }
993
- });
994
-
995
-
996
- client.on('interactionCreate', async (i) => {
997
- if (i.customId === 'button_checker') {
998
- try {
999
- // Specify the required permissions you want to check
1000
- const requiredPermissions = ['KickMembers', 'BanMembers', 'ManageChannels'];
1001
-
1002
- // Instantiate the PermissionChecker
1003
- const permissionChecker = new PermissionChecker();
1004
-
1005
- // Check if the message author has the required permissions
1006
- const hasPermissions = await permissionChecker.checker(i.user.id, i.guild, requiredPermissions);
1007
-
1008
- if (hasPermissions) {
1009
- i.reply('You have the required permissions!');
1010
- } else {
1011
- i.reply('You do not have the required permissions!');
1012
- }
1013
- } catch (error) {
1014
- console.error('Error:', error.message);
1015
- }
1016
- }
1017
- });
1018
- ```
1019
- </details>
1020
320
 
1021
321
  ## 📚 More Info & Documentation 📖
1022
322
  <details>
1023
323
 
1024
- - Explore a detailed list of apexify.js and their usage at our [Support Server](https://discord.gg/FsmKSmxJjD).
324
+ - Explore a detailed list of apexify.js and their usage at our [Support Server](https://discord.gg/MbrvstwNjs).
1025
325
 
1026
326
  ## 🚨 Important Notes 📌
1027
327
 
1028
328
  1. **Voice Messages:** Currently in beta, occasional disruptions may occur.
1029
329
 
1030
- 2. **Commands:** Support for slash commands is coming soon.
1031
-
1032
- 3. **Music:** Utilizing Lavalink for audio streaming. Customize Lavalink node if needed.
1033
-
1034
- 4. **Database:** There is two type of Database NanoDb (local db json) and MongoDb (online db bson).
1035
-
1036
330
  Keep experimenting, and feel free to contact me for assistance! Suggestions and adjustments are welcome. 🌟
1037
331
  </details>
1038
332