djs-builder 0.6.40 → 0.6.401

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
@@ -1772,6 +1772,219 @@ module.exports = {
1772
1772
 
1773
1773
  ---
1774
1774
 
1775
+ <details>
1776
+ <summary>Blacklist System 🚫</summary>
1777
+
1778
+ ## 🚫 Blacklist System – Restrict Access to Commands
1779
+
1780
+ The **Blacklist System** allows you to block specific **users**, **roles**, or **channels** from using your bot's commands. This is useful for moderation and preventing abuse.
1781
+
1782
+ > **Note**: To use this module, you **MUST** have **DATABASE** connection.
1783
+
1784
+ > **Note**: You can get all data by requiring the **Blacklist** module.
1785
+
1786
+ ---
1787
+
1788
+ ### 📦 Module Exports
1789
+
1790
+ ```js
1791
+ const {
1792
+ isBlacklisted,
1793
+ addToBlacklist,
1794
+ removeFromBlacklist,
1795
+ getBlacklist,
1796
+ Blacklist,
1797
+ } = require("djs-builder");
1798
+ ```
1799
+
1800
+ - `isBlacklisted(guildId, type, id)` → Check if a target is blacklisted 🔍.
1801
+ - `addToBlacklist(guildId, type, id)` → Add a target to the blacklist ➕.
1802
+ - `removeFromBlacklist(guildId, type, id)` → Remove a target from the blacklist ➖.
1803
+ - `getBlacklist(guildId, type)` → Get all blacklisted items (optionally filtered by type) 📜.
1804
+ - `Blacklist` → The Mongoose model for direct DB access 💾.
1805
+
1806
+ ---
1807
+
1808
+ ### 🔍 isBlacklisted – Check Status
1809
+
1810
+ Checks if a user, role, or channel is blacklisted.
1811
+
1812
+ ```js
1813
+ const isBlocked = await isBlacklisted("GUILD_ID", "user", "USER_ID");
1814
+ if (isBlocked) {
1815
+ console.log("User is blacklisted! 🚫");
1816
+ }
1817
+ ```
1818
+
1819
+ ---
1820
+
1821
+ ### ➕ addToBlacklist – Block a Target
1822
+
1823
+ Adds a user, role, or channel to the blacklist.
1824
+
1825
+ ```js
1826
+ await addToBlacklist("GUILD_ID", "channel", "CHANNEL_ID");
1827
+ console.log("Channel blacklisted successfully! 🔒");
1828
+ ```
1829
+
1830
+ ---
1831
+
1832
+ ### ➖ removeFromBlacklist – Unblock a Target
1833
+
1834
+ Removes a user, role, or channel from the blacklist.
1835
+
1836
+ ```js
1837
+ await removeFromBlacklist("GUILD_ID", "role", "ROLE_ID");
1838
+ console.log("Role unblacklisted! 🔓");
1839
+ ```
1840
+
1841
+ ---
1842
+
1843
+ ### 📜 getBlacklist – List Blacklisted Items
1844
+
1845
+ Returns an array of blacklisted items for a guild. You can optionally filter by type (`user`, `role`, `channel`).
1846
+
1847
+ **Parameters:**
1848
+ - `guildId` (String): The ID of the guild.
1849
+ - `type` (String, optional): The type to filter by (`user`, `role`, `channel`).
1850
+
1851
+ **Example:**
1852
+ ```js
1853
+ // Get all blacklisted items
1854
+ const allBlacklisted = await getBlacklist("GUILD_ID");
1855
+ console.log(allBlacklisted);
1856
+
1857
+ // Get only blacklisted users
1858
+ const blacklistedUsers = await getBlacklist("GUILD_ID", "user");
1859
+ console.log(blacklistedUsers);
1860
+ /*
1861
+ Output:
1862
+ [
1863
+ { guild: 'GUILD_ID', type: 'user', id: 'USER_ID_1', ... },
1864
+ { guild: 'GUILD_ID', type: 'user', id: 'USER_ID_2', ... }
1865
+ ]
1866
+ */
1867
+ ```
1868
+
1869
+ ---
1870
+
1871
+ ### ⚡ Practical Example: Blacklist Command
1872
+
1873
+ You can create a slash command to manage the blacklist easily.
1874
+
1875
+ ```js
1876
+ const { addToBlacklist, removeFromBlacklist, isBlacklisted, getBlacklist } = require("djs-builder");
1877
+ const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } = require("discord.js");
1878
+
1879
+ module.exports = {
1880
+ data: new SlashCommandBuilder()
1881
+ .setName("blacklist")
1882
+ .setDescription("Manage the blacklist")
1883
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
1884
+ .addSubcommand(sub =>
1885
+ sub.setName("add").setDescription("Add to blacklist")
1886
+ .addUserOption(opt => opt.setName("user").setDescription("User to blacklist"))
1887
+ .addRoleOption(opt => opt.setName("role").setDescription("Role to blacklist"))
1888
+ .addChannelOption(opt => opt.setName("channel").setDescription("Channel to blacklist"))
1889
+ )
1890
+ .addSubcommand(sub =>
1891
+ sub.setName("remove").setDescription("Remove from blacklist")
1892
+ .addUserOption(opt => opt.setName("user").setDescription("User to remove"))
1893
+ .addRoleOption(opt => opt.setName("role").setDescription("Role to remove"))
1894
+ .addChannelOption(opt => opt.setName("channel").setDescription("Channel to remove"))
1895
+ )
1896
+ .addSubcommand(sub =>
1897
+ sub.setName("check").setDescription("Check if a target is blacklisted")
1898
+ .addUserOption(opt => opt.setName("user").setDescription("User to check"))
1899
+ .addRoleOption(opt => opt.setName("role").setDescription("Role to check"))
1900
+ .addChannelOption(opt => opt.setName("channel").setDescription("Channel to check"))
1901
+ )
1902
+ .addSubcommand(sub =>
1903
+ sub.setName("list").setDescription("List all blacklisted items")
1904
+ .addStringOption(opt => opt.setName("type").setDescription("Filter by type").addChoices({ name: "User", value: "user" }, { name: "Role", value: "role" }, { name: "Channel", value: "channel" } , { name: "All", value: "all" }))
1905
+ ),
1906
+ async run(interaction) {
1907
+ const sub = interaction.options.getSubcommand();
1908
+ const user = interaction.options.getUser("user");
1909
+ const role = interaction.options.getRole("role");
1910
+ const channel = interaction.options.getChannel("channel");
1911
+ const guildId = interaction.guild.id;
1912
+
1913
+ if (sub === "list") {
1914
+ const type = interaction.options.getString("type");
1915
+ if (type !== "all") {
1916
+ const list = await getBlacklist(guildId, type);
1917
+
1918
+ if (!list.length) return interaction.reply({ content: "✅ No blacklisted items found.", flags : 64 });
1919
+
1920
+ const embed = new EmbedBuilder()
1921
+ .setTitle("🚫 Blacklist")
1922
+ .setColor("Red")
1923
+ .setDescription(list.map(item => `• **${item.type.toUpperCase()}**: <${item.type === 'channel' ? '#' : item.type === 'role' ? '@&' : '@'}${item.id}> (\`${item.id}\`)`).join("\n").slice(0, 4096));
1924
+
1925
+ return interaction.reply({ embeds: [embed], flags : 64 });
1926
+ } else {
1927
+ const list = await getBlacklist(guildId);
1928
+ if (!list.length) return interaction.reply({ content: "✅ No blacklisted items found.", flags : 64 });
1929
+
1930
+ const embeds = [];
1931
+ const roles = list.filter(i => i.type === "role");
1932
+ const users = list.filter(i => i.type === "user");
1933
+ const channels = list.filter(i => i.type === "channel");
1934
+
1935
+ if (users.length) {
1936
+ const userEmbed = new EmbedBuilder()
1937
+ .setTitle("🚫 Blacklisted Users")
1938
+ .setColor("Red")
1939
+ .setDescription(users.map(item => `• <@${item.id}> (\`${item.id}\`)`).join("\n").slice(0, 4096));
1940
+ embeds.push(userEmbed);
1941
+ }
1942
+ if( roles.length) {
1943
+ const roleEmbed = new EmbedBuilder()
1944
+ .setTitle("🚫 Blacklisted Roles")
1945
+ .setColor("Red")
1946
+ .setDescription(roles.map(item => `• <@&${item.id}> (\`${item.id}\`)`).join("\n").slice(0, 4096));
1947
+ embeds.push(roleEmbed);
1948
+ }
1949
+ if( channels.length) {
1950
+ const channelEmbed = new EmbedBuilder()
1951
+ .setTitle("🚫 Blacklisted Channels")
1952
+ .setColor("Red")
1953
+ .setDescription(channels.map(item => `• <#${item.id}> (\`${item.id}\`)`).join("\n").slice(0, 4096));
1954
+ embeds.push(channelEmbed);
1955
+ }
1956
+ return interaction.reply({ embeds, flags : 64 });
1957
+ }
1958
+ }
1959
+
1960
+ if (!user && !role && !channel) {
1961
+ return interaction.reply({ content: "⚠️ You must provide at least one option (User, Role, or Channel).", flags : 64 });
1962
+ }
1963
+ const target = user || role || channel;
1964
+ const type = user ? "user" : role ? "role" : "channel";
1965
+ const id = target.id;
1966
+
1967
+ if (sub === "add") {
1968
+ const success = await addToBlacklist(guildId, type, id);
1969
+ if (success) interaction.reply(`✅ Added **${type}** ${target} to blacklist.`);
1970
+ else interaction.reply(`⚠️ **${type}** ${target} is already blacklisted.`);
1971
+ } else if (sub === "remove") {
1972
+ const success = await removeFromBlacklist(guildId, type, id);
1973
+ if (success) interaction.reply(`✅ Removed **${type}** ${target} from blacklist.`);
1974
+ else interaction.reply(`⚠️ **${type}** ${target} is not blacklisted.`);
1975
+ } else if (sub === "check") {
1976
+ const isBlocked = await isBlacklisted(guildId, type, id);
1977
+ if (isBlocked) interaction.reply(`🚫 **${type}** ${target} is currently **blacklisted**.`);
1978
+ else interaction.reply(`✅ **${type}** ${target} is **not** blacklisted.`);
1979
+ }
1980
+ }
1981
+ };
1982
+ ```
1983
+
1984
+ </details>
1985
+
1986
+ ---
1987
+
1775
1988
  <details>
1776
1989
  <summary>Hot Reloading 🔄</summary>
1777
1990
 
@@ -1812,10 +2025,7 @@ module.exports = {
1812
2025
  { name: "All", value: "all" }
1813
2026
  )
1814
2027
  ),
1815
- ownerOnly: true,
1816
2028
  async run(interaction, client) {
1817
- // Check for owner permission (Recommended)
1818
-
1819
2029
  const type = interaction.options.getString("type");
1820
2030
 
1821
2031
  try {
@@ -1877,6 +2087,7 @@ devOnly: true, // 🛠️ Only bot developer can use this comman
1877
2087
  guildOnly: true, // 🏠 Command works only in servers
1878
2088
  dmOnly: true, // ✉️ Command works only in DMs
1879
2089
  fastUse: true, // ⚡ Allow command to be executed without prefix (Prefix only)
2090
+ Blacklist: true, // 🚫 Check if user/role/channel is blacklisted
1880
2091
  run: Function, // 🏃‍♂️ Main function to run the command
1881
2092
  execute: Function, // 🏃‍♂️ Alternative function to run the command
1882
2093
  ```
@@ -0,0 +1,64 @@
1
+ const { Schema, model } = require("mongoose");
2
+
3
+ const blacklistschema = new Schema({
4
+ guild: { type: String, required: true },
5
+ type: { type: String, required: true },
6
+ id: { type: String, required: true },
7
+ });
8
+
9
+ const Blacklist = model("Blacklist", blacklistschema);
10
+
11
+ async function isBlacklisted(guildId, type, id) {
12
+ const is = await Blacklist.findOne({
13
+ guild: guildId,
14
+ type: type,
15
+ id: id,
16
+ });
17
+ return is;
18
+ }
19
+
20
+ async function addToBlacklist(guildId, type, id) {
21
+ const is = await Blacklist.findOne({
22
+ guild: guildId,
23
+ type: type,
24
+ id: id,
25
+ });
26
+ if (is) return false;
27
+
28
+ await Blacklist.create({
29
+ guild: guildId,
30
+ type: type,
31
+ id: id,
32
+ });
33
+ return true;
34
+ }
35
+
36
+ async function removeFromBlacklist(guildId, type, id) {
37
+ const is = await Blacklist.findOne({
38
+ guild: guildId,
39
+ type: type,
40
+ id: id,
41
+ });
42
+ if (!is) return false;
43
+ await Blacklist.deleteOne({
44
+ guild: guildId,
45
+ type: type,
46
+ id: id,
47
+ });
48
+ return true;
49
+ }
50
+
51
+ async function getBlacklist(guildId, type) {
52
+ const query = { guild: guildId };
53
+ if (type) query.type = type;
54
+ return await Blacklist.find(query);
55
+ }
56
+
57
+
58
+ module.exports = {
59
+ Blacklist,
60
+ isBlacklisted,
61
+ addToBlacklist,
62
+ removeFromBlacklist,
63
+ getBlacklist
64
+ };
@@ -8,8 +8,8 @@ const giveawaySchema = new Schema({
8
8
  messageId: { type: String, required: true },
9
9
  hoster: { type: String, required: true },
10
10
  endEmbed: { type: Object, required: true },
11
- winwesNumber: { type: Number, default: 1 },
12
- winers: Array,
11
+ winnerCount: { type: Number, default: 1 },
12
+ winners: Array,
13
13
  paused: { type: Boolean, default: false },
14
14
  pausedTime: Array,
15
15
  endTime: { type: String, required: true },
@@ -30,7 +30,7 @@ const giveaway = model("giveaway", giveawaySchema);
30
30
  async function Gstart({
31
31
  context,
32
32
  endTime: endTime,
33
- winers: winers,
33
+ winers: winnerCount,
34
34
  channelId: channelId,
35
35
  embed: {
36
36
  custom: Scustom = false,
@@ -38,7 +38,7 @@ async function Gstart({
38
38
  description: Sdescription = false,
39
39
  color: Scolor = false,
40
40
  image: Simage = false,
41
- theumbnail: Sthumbnail = false,
41
+ thumbnail: Sthumbnail = false,
42
42
  } = {},
43
43
  endEmbed: {
44
44
  custom: Ecustom = false,
@@ -46,7 +46,7 @@ async function Gstart({
46
46
  description: Edescription = false,
47
47
  color: Ecolor = false,
48
48
  image: Eimage = false,
49
- theumbnail: Ethumbnail = false,
49
+ thumbnail: Ethumbnail = false,
50
50
  } = {},
51
51
  reaction: {
52
52
  type: type = false,
@@ -56,7 +56,7 @@ async function Gstart({
56
56
  id : id = false
57
57
  },
58
58
  }) {
59
- if (!winers) winers = 1;
59
+ if (!winnerCount) winnerCount = 1;
60
60
  if (!endTime) return { error: "End time is required." };
61
61
  if (!channelId) return { error: "Channel ID is required." };
62
62
  if (!context) return { error: "Context is required." };
@@ -93,7 +93,7 @@ async function Gstart({
93
93
 
94
94
  embed.addFields({
95
95
  name: "🎉 Giveaway",
96
- value: `- Winer(s) : ${winers}\n- Time : <t:${Math.floor(
96
+ value: `- Winer(s) : ${winnerCount}\n- Time : <t:${Math.floor(
97
97
  endTime / 1000
98
98
  )}:R>\n- Hosted By : ${context.user ? context.user : context.author}`,
99
99
  inline: true,
@@ -124,7 +124,7 @@ async function Gstart({
124
124
 
125
125
  end_embed.addFields({
126
126
  name: "🎉 Giveaway",
127
- value: `- Winer(s): ${winers}\n- Time : <t:${Math.floor(
127
+ value: `- Winer(s): ${winnerCount}\n- Time : <t:${Math.floor(
128
128
  endTime / 1000
129
129
  )}:R>\n- Hosted By : ${context.user ? context.user : context.author}`,
130
130
  inline: true,
@@ -139,8 +139,8 @@ async function Gstart({
139
139
  endType: false,
140
140
  paused: false,
141
141
  pausedTime: [],
142
- winers: [],
143
- winwesNumber: winers,
142
+ winners: [],
143
+ winnerCount: winnerCount,
144
144
  ended: false,
145
145
  reaction: type,
146
146
  endEmbed: end_embed.toJSON(),
@@ -204,7 +204,7 @@ async function giveaway_end(client, g, type) {
204
204
  return;
205
205
  }
206
206
 
207
- const winners = pickWinners(users_id, g.winwesNumber);
207
+ const winners = pickWinners(users_id, g.winnerCount);
208
208
 
209
209
  await message.edit({
210
210
  embeds: [g.endEmbed],
@@ -218,7 +218,7 @@ async function giveaway_end(client, g, type) {
218
218
 
219
219
  await giveaway.findOneAndUpdate(
220
220
  { messageId: message.id },
221
- { ended: true, winers: winners, endType: type ? type : "Time End" }
221
+ { ended: true, winners: winners, endType: type ? type : "Time End" }
222
222
  );
223
223
  } catch (e) {
224
224
  console.log(e);
@@ -255,7 +255,7 @@ async function Greroll(client, messageId) {
255
255
  );
256
256
  }
257
257
 
258
- const winners = pickWinners(users_id, g.winwesNumber);
258
+ const winners = pickWinners(users_id, g.winnerCount);
259
259
 
260
260
  await message.reply({
261
261
  content: `🔄️ **Giveaway Reroll!**\n> Winner(s):\n- <@${winners
@@ -274,7 +274,7 @@ async function Greroll(client, messageId) {
274
274
 
275
275
  await giveaway.findOneAndUpdate(
276
276
  { messageId: messageId },
277
- { winers: winners, endType: new_endType }
277
+ { winners: winners, endType: new_endType }
278
278
  );
279
279
  } catch (e) {
280
280
  console.log(e);
@@ -302,8 +302,8 @@ async function Glist(type) {
302
302
  paused: g.paused,
303
303
  pausedTime: g.pausedTime,
304
304
  endType: g.endType,
305
- winers: g.winers,
306
- winwesNumber: g.winwesNumber,
305
+ winners: g.winners,
306
+ winnerCount: g.winnerCount,
307
307
  endEmbed: g.endEmbed,
308
308
  };
309
309
  });
@@ -328,7 +328,7 @@ async function Gpause(client, messageId) {
328
328
 
329
329
  message.embeds[0].data.fields.find(
330
330
  (f) => f.name === "🎉 Giveaway"
331
- ).value = `- Winer(s): ${g.winwesNumber}\n- Time : Pause ⏸️\n- Hosted By : <@${g.hoster}>`;
331
+ ).value = `- Winer(s): ${g.winnerCount}\n- Time : Pause ⏸️\n- Hosted By : <@${g.hoster}>`;
332
332
 
333
333
  await message.edit({ embeds: [message.embeds[0]] });
334
334
  await giveaway.findOneAndUpdate(
@@ -356,7 +356,7 @@ async function Gresume(client, messageId) {
356
356
 
357
357
  message.embeds[0].data.fields.find(
358
358
  (f) => f.name === "🎉 Giveaway"
359
- ).value = `- Winer(s): ${g.winwesNumber}\n- Time : <t:${Math.floor(
359
+ ).value = `- Winer(s): ${g.winnerCount}\n- Time : <t:${Math.floor(
360
360
  time / 1000
361
361
  )}:R>\n- Hosted By : <@${g.hoster}>`;
362
362
 
@@ -434,7 +434,7 @@ async function GaddTime(messageId, client, time) {
434
434
 
435
435
  message.embeds[0].data.fields.find(
436
436
  (f) => f.name === "🎉 Giveaway"
437
- ).value = `- Winer(s): ${g.winwesNumber}\n- Time : <t:${Math.floor(
437
+ ).value = `- Winer(s): ${g.winnerCount}\n- Time : <t:${Math.floor(
438
438
  finel_time / 1000
439
439
  )}:R>\n- Hosted By : <@${g.hoster}>`;
440
440
 
@@ -466,7 +466,7 @@ async function GremoveTime(messageId, client, time) {
466
466
 
467
467
  message.embeds[0].data.fields.find(
468
468
  (f) => f.name === "🎉 Giveaway"
469
- ).value = `- Winer(s): ${g.winwesNumber}\n- Time : <t:${Math.floor(
469
+ ).value = `- Winer(s): ${g.winnerCount}\n- Time : <t:${Math.floor(
470
470
  finel_time / 1000
471
471
  )}:R>\n- Hosted By : <@${g.hoster}>`;
472
472
 
package/function/level.js CHANGED
@@ -66,7 +66,7 @@ async function UserLevel(userId, guildId) {
66
66
  );
67
67
  }
68
68
 
69
- ////////////////////////////////! 🏆 اtop
69
+ ////////////////////////////////! 🏆 top
70
70
  async function leaderboard(guildId, type = "totalXP", limit = 10) {
71
71
  return await Level.find({ guildId })
72
72
  .sort({ [type]: -1 })
package/handler/helper.js CHANGED
@@ -16,7 +16,7 @@ async function cooldowns(client, name, time, user) {
16
16
  if (now < expirationTime) {
17
17
  const remaining = ((expirationTime - now) / 1000).toFixed(1);
18
18
  return {
19
- text: `⏳ انتظر ${remaining} ثانية قبل استخدام هذا الأمر مرة أخرى.`,
19
+ text: `⏳ Wait ${remaining} seconds before using this command again.`,
20
20
  type: true,
21
21
  };
22
22
  }
@@ -137,7 +137,7 @@ async function data_conecter(url) {
137
137
  await mongoose.connect(url);
138
138
  return true;
139
139
  } catch (error) {
140
- console.error("❌ فشل الاتصال بقاعدة البيانات:", error);
140
+ console.error("❌ Failed to connect to the database:", error);
141
141
  return false;
142
142
  }
143
143
  }
@@ -41,17 +41,16 @@ async function loadPrefix(client, path) {
41
41
 
42
42
  async function loadSlash(client, path) {
43
43
  const slash_files = await readFile(path);
44
-
45
-
44
+
46
45
  for (const file of slash_files) {
47
- delete require.cache[require.resolve(file.path)];
46
+ delete require.cache[require.resolve(file.path)];
48
47
  }
49
48
 
50
49
  const validSlashCommands = slash_files
51
50
  .map((f) => {
52
- const cmd = require(f.path);
53
- cmd.file_path = f.path;
54
- return cmd;
51
+ const cmd = require(f.path);
52
+ cmd.file_path = f.path;
53
+ return cmd;
55
54
  })
56
55
  .filter(
57
56
  (cmd) =>
@@ -70,20 +69,18 @@ async function loadSlash(client, path) {
70
69
 
71
70
  async function loadEvents(client, path) {
72
71
  const event_files = await readFile(path);
73
-
74
-
72
+
75
73
  if (!client.djsEventListeners) {
76
- client.djsEventListeners = new Map();
74
+ client.djsEventListeners = new Map();
77
75
  }
78
76
 
79
-
80
77
  for (const file of event_files) {
81
- if (client.djsEventListeners.has(file.path)) {
82
- const { name, listener } = client.djsEventListeners.get(file.path);
83
- client.removeListener(name, listener);
84
- client.djsEventListeners.delete(file.path);
85
- }
86
- delete require.cache[require.resolve(file.path)];
78
+ if (client.djsEventListeners.has(file.path)) {
79
+ const { name, listener } = client.djsEventListeners.get(file.path);
80
+ client.removeListener(name, listener);
81
+ client.djsEventListeners.delete(file.path);
82
+ }
83
+ delete require.cache[require.resolve(file.path)];
87
84
  }
88
85
 
89
86
  for (const file of event_files) {
@@ -111,7 +108,7 @@ async function loadEvents(client, path) {
111
108
  };
112
109
  client.on(event.name, listener);
113
110
  }
114
-
111
+
115
112
  client.djsEventListeners.set(file.path, { name: event.name, listener });
116
113
  termenal.events++;
117
114
  }
@@ -119,23 +116,27 @@ async function loadEvents(client, path) {
119
116
  }
120
117
 
121
118
  async function reload(client, type) {
122
- if (!client.djsOptions) return console.error("❌ Options not found on client.");
123
-
124
- if (type === "prefix" && client.djsOptions.prefix) {
125
- await loadPrefix(client, client.djsOptions.prefix.path);
126
- console.log("✅ Prefix commands reloaded.");
127
- } else if (type === "slash" && client.djsOptions.slash) {
128
- await loadSlash(client, client.djsOptions.slash.path);
129
- console.log("✅ Slash commands reloaded (Internal Cache).");
130
- } else if (type === "events" && client.djsOptions.events) {
131
- await loadEvents(client, client.djsOptions.events.path);
132
- console.log("✅ Events reloaded.");
133
- } else if (type === "all") {
134
- if (client.djsOptions.prefix) await loadPrefix(client, client.djsOptions.prefix.path);
135
- if (client.djsOptions.slash) await loadSlash(client, client.djsOptions.slash.path);
136
- if (client.djsOptions.events) await loadEvents(client, client.djsOptions.events.path);
137
- console.log("✅ All systems reloaded.");
138
- }
119
+ if (!client.djsOptions)
120
+ return console.error("❌ Options not found on client.");
121
+
122
+ if (type === "prefix" && client.djsOptions.prefix) {
123
+ await loadPrefix(client, client.djsOptions.prefix.path);
124
+ console.log("✅ Prefix commands reloaded.");
125
+ } else if (type === "slash" && client.djsOptions.slash) {
126
+ await loadSlash(client, client.djsOptions.slash.path);
127
+ console.log("✅ Slash commands reloaded (Internal Cache).");
128
+ } else if (type === "events" && client.djsOptions.events) {
129
+ await loadEvents(client, client.djsOptions.events.path);
130
+ console.log("✅ Events reloaded.");
131
+ } else if (type === "all") {
132
+ if (client.djsOptions.prefix)
133
+ await loadPrefix(client, client.djsOptions.prefix.path);
134
+ if (client.djsOptions.slash)
135
+ await loadSlash(client, client.djsOptions.slash.path);
136
+ if (client.djsOptions.events)
137
+ await loadEvents(client, client.djsOptions.events.path);
138
+ console.log("✅ All systems reloaded.");
139
+ }
139
140
  }
140
141
 
141
142
  async function starter(client, options) {
@@ -258,11 +259,7 @@ async function starter(client, options) {
258
259
 
259
260
  if (command.guildOnly && !message.guild) return;
260
261
  if (command.dmOnly && message.guild) return;
261
- if (
262
- command.devOnly &&
263
- message.author.id !== client.owner.id
264
- )
265
- return;
262
+ if (command.devOnly && message.author.id !== client.owner.id) return;
266
263
  if (
267
264
  command.ownerOnly &&
268
265
  message.guild &&
@@ -277,6 +274,43 @@ async function starter(client, options) {
277
274
  )
278
275
  return;
279
276
 
277
+
278
+ if(command.Blacklist) {
279
+
280
+ const userBlacklisted = await isBlacklisted(message.guild ? message.guild.id : null, 'user', message.author.id);
281
+ if(userBlacklisted) {
282
+ return message.reply({
283
+ content: "`❌` You are blacklisted from using bot commands.",
284
+ flags: 64,
285
+ });
286
+ }
287
+
288
+ let roleBlacklist = null;
289
+ for (const [id, role] of message.member.roles.cache) {
290
+ const isBlocked = await isBlacklisted(message.guild ? message.guild.id : null, 'role', id);
291
+ if (isBlocked) {
292
+ roleBlacklist = isBlocked;
293
+ break;
294
+ }
295
+ }
296
+
297
+ if(roleBlacklist) {
298
+ const role = message.guild.roles.cache.get(roleBlacklist.id);
299
+ return message.reply({
300
+ content: `\`❌\` The role **${role ? role.name : 'Unknown'}** is blacklisted from using bot commands.`,
301
+ flags: 64,
302
+ });
303
+ }
304
+
305
+ const channelBlacklist = await isBlacklisted(message.guild ? message.guild.id : null, 'channel', message.channel.id);
306
+ if(channelBlacklist) {
307
+ return message.reply({
308
+ content: "`❌` This channel is blacklisted from using bot commands.",
309
+ flags: 64,
310
+ });
311
+ }
312
+ }
313
+
280
314
  const args = content.split(/\s+/).slice(1);
281
315
 
282
316
  if (options.prefix.log) {
@@ -318,31 +352,28 @@ async function starter(client, options) {
318
352
  interaction.user.id !== (await interaction.guild.fetchOwner()).id
319
353
  ) {
320
354
  return interaction.reply({
321
- content: "`❌` هذا الأمر محصور لصاحب السيرفر فقط!",
355
+ content: "`❌` This command is restricted to the server owner only!",
322
356
  flags: 64,
323
357
  });
324
358
  }
325
359
 
326
- if (
327
- command.devOnly &&
328
- interaction.user.id !== client.owner.id
329
- ) {
360
+ if (command.devOnly && interaction.user.id !== client.owner.id) {
330
361
  return interaction.reply({
331
- content: "`❌` هذا الأمر محصور لصاحب البوت فقط!",
362
+ content: "`❌` This command is restricted to the bot owner only!",
332
363
  flags: 64,
333
364
  });
334
365
  }
335
366
 
336
367
  if (command.guildOnly && !interaction.guild) {
337
368
  return interaction.reply({
338
- content: "`❌` هذا الأمر محصور لسيرفرات فقط!",
369
+ content: "`❌` This command is restricted to servers only!",
339
370
  flags: 64,
340
371
  });
341
372
  }
342
373
 
343
374
  if (command.dmOnly && interaction.guild) {
344
375
  return interaction.reply({
345
- content: "`❌` هذا الأمر محصور لمحادثات الخاصة فقط!",
376
+ content: "`❌` This command is restricted to DMs only!",
346
377
  flags: 64,
347
378
  });
348
379
  }
@@ -355,11 +386,47 @@ async function starter(client, options) {
355
386
  )
356
387
  ) {
357
388
  return interaction.reply({
358
- content: "`❌` أنت لا تملك صلاحيات كافية لتنفيذ هذا الأمر.",
389
+ content: "`❌` You do not have enough permissions to execute this command.",
359
390
  flags: 64,
360
391
  });
361
392
  }
362
393
 
394
+ if(command.Blacklist) {
395
+
396
+ const userBlacklisted = await isBlacklisted(interaction.guild ? interaction.guild.id : null, 'user', interaction.user.id);
397
+ if(userBlacklisted) {
398
+ return interaction.reply({
399
+ content: "`❌` You are blacklisted from using bot commands.",
400
+ flags: 64,
401
+ });
402
+ }
403
+
404
+ let roleBlacklist = null;
405
+ for (const [id, role] of interaction.member.roles.cache) {
406
+ const isBlocked = await isBlacklisted(interaction.guild ? interaction.guild.id : null, 'role', id);
407
+ if (isBlocked) {
408
+ roleBlacklist = isBlocked;
409
+ break;
410
+ }
411
+ }
412
+
413
+ if(roleBlacklist) {
414
+ const role = interaction.guild.roles.cache.get(roleBlacklist.id);
415
+ return interaction.reply({
416
+ content: `\`❌\` The role **${role ? role.name : 'Unknown'}** is blacklisted from using bot commands.`,
417
+ flags: 64,
418
+ });
419
+ }
420
+
421
+ const channelBlacklist = await isBlacklisted(interaction.guild ? interaction.guild.id : null, 'channel', interaction.channel.id);
422
+ if(channelBlacklist) {
423
+ return interaction.reply({
424
+ content: "`❌` This channel is blacklisted from using bot commands.",
425
+ flags: 64,
426
+ });
427
+ }
428
+ }
429
+
363
430
  try {
364
431
  if (typeof command.run === "function") {
365
432
  await command.run(interaction, client);
@@ -370,12 +437,12 @@ async function starter(client, options) {
370
437
  console.error(error);
371
438
  if (interaction.replied || interaction.deferred) {
372
439
  await interaction.followUp({
373
- content: "`❌` حدث خطأ أثناء تنفيذ الأمر.",
440
+ content: "`❌` An error occurred while executing the command.",
374
441
  flags: 64,
375
442
  });
376
443
  } else {
377
444
  await interaction.reply({
378
- content: "`❌` حدث خطأ أثناء تنفيذ الأمر.",
445
+ content: "`❌` An error occurred while executing the command.",
379
446
  flags: 64,
380
447
  });
381
448
  }
@@ -416,7 +483,13 @@ async function starter(client, options) {
416
483
  const { Wait, CreateBar, CreateRow, GetUser } = require("../function/function");
417
484
  const { Level, addXP, UserLevel, leaderboard } = require("../function/level");
418
485
  const { log } = require("../function/log");
419
-
486
+ const {
487
+ Blacklist,
488
+ isBlacklisted,
489
+ addToBlacklist,
490
+ removeFromBlacklist,
491
+ getBlacklist
492
+ } = require("../function/blacklist");
420
493
  const {
421
494
  giveaway,
422
495
  Gstart,
@@ -430,7 +503,7 @@ const {
430
503
  GremoveUser,
431
504
  GaddTime,
432
505
  GremoveTime,
433
- Gdata
506
+ Gdata,
434
507
  } = require("../function/giveaway");
435
508
 
436
509
  module.exports = {
@@ -457,5 +530,10 @@ module.exports = {
457
530
  GremoveUser,
458
531
  GaddTime,
459
532
  GremoveTime,
460
- Gdata
533
+ Gdata,
534
+ Blacklist,
535
+ isBlacklisted,
536
+ addToBlacklist,
537
+ removeFromBlacklist,
538
+ getBlacklist
461
539
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "djs-builder",
3
- "version": "0.6.40",
3
+ "version": "0.6.401",
4
4
  "note": "🎉 Package Update! 🥏\n\n- 📚 Documentation: Added full guide for Giveaway System & Hot Reloading.\n- 🐛 Bug Fixes: Fixed critical issue in Giveaway winner selection.\n\n🔗 Learn more on [NPM](https://www.npmjs.com/package/djs-builder)",
5
5
  "description": "🎉 Package Update! 🥏",
6
6
  "main": "handler/starter.js",