djs-builder 0.6.13 → 0.6.14

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/handler/helper.js CHANGED
@@ -191,6 +191,8 @@ async function set_anticrash(data) {
191
191
  process.on("warning", (error) => send(error, "warn"));
192
192
  }
193
193
 
194
+
195
+
194
196
  async function cmd_log(client, data, commandName, channelId) {
195
197
  const isSlash = !!data.user;
196
198
  const user = isSlash ? data.user : data.author;
@@ -198,15 +200,23 @@ async function cmd_log(client, data, commandName, channelId) {
198
200
  const logChannel = client.channels.cache.get(channelId);
199
201
  if (!logChannel) return;
200
202
 
201
- let messageLink;
202
- if (interaction.channel) {
203
- messageLink = `https://discord.com/channels/${interaction.guild.id}/${interaction.channel.id}/${interaction.id}`;
204
- } else {
205
- messageLink = "Unknown";
206
- }
207
203
 
204
+ let messageLink = "Unknown";
205
+ try {
206
+ if (isSlash) {
207
+
208
+ const reply = await data.fetchReply()
209
+ if (reply) {
210
+ messageLink = `https://discord.com/channels/${data.guild.id}/${data.channel.id}/${reply.id}`;
211
+ }
212
+ } else {
213
+ if (data.guild && data.channel) {
214
+ messageLink = `https://discord.com/channels/${data.guild.id}/${data.channel.id}/${data.id}`;
215
+ }
216
+ }
217
+ } catch (err) {}
208
218
 
209
- const field = [
219
+ const fields = [
210
220
  {
211
221
  name: "šŸ“§ Cmd:",
212
222
  value: `- ${commandName}`,
@@ -214,63 +224,63 @@ async function cmd_log(client, data, commandName, channelId) {
214
224
  },
215
225
  {
216
226
  name: "šŸ‘¤ User:",
217
- value: `- ${user?.tag ?? "Unknown user"} | (\`${
218
- user?.id ?? "Unknown ID"
219
- }\`)`,
220
- inline: true,
221
- },
222
- {
223
- name: "\u200B",
224
- value: "\u200B",
227
+ value: `- ${user?.tag ?? "Unknown user"} | (\`${user?.id ?? "Unknown ID"}\`)`,
225
228
  inline: true,
226
229
  },
230
+ { name: "\u200B", value: "\u200B", inline: true },
227
231
  ];
228
232
 
229
233
  if (data.guild && data.channel) {
230
- field.push(
234
+ fields.push(
231
235
  {
232
236
  name: "šŸ  Server:",
233
237
  value: `- ${data.guild.name} | (\`${data.guild.id}\`)`,
234
238
  inline: true,
235
239
  },
236
240
  {
237
- name: "šŸ’¬ Channel",
241
+ name: "šŸ’¬ Channel:",
238
242
  value: `- ${data.channel.name} | (\`${data.channel.id}\`)`,
239
243
  inline: true,
240
244
  },
245
+ { name: "\u200B", value: "\u200B", inline: true },
241
246
  {
242
- name: "\u200B",
243
- value: "\u200B",
244
- inline: true,
245
- },
246
- {
247
- name: "šŸ”— Message",
248
- value: messageLink ? `- [Link](${messageLink})` : "not found",
247
+ name: "šŸ”— Message:",
248
+ value: messageLink !== "Unknown" ? `- [Link](${messageLink})` : "Not found",
249
249
  inline: true,
250
250
  }
251
251
  );
252
- } else if (!data.guild) {
253
- field.push({
254
- name: "šŸ‘€ DM Message",
252
+ } else {
253
+ fields.push({
254
+ name: "šŸ‘€ DM Message:",
255
255
  value: `${user?.tag ?? "Unknown user"}`,
256
256
  inline: true,
257
257
  });
258
258
  }
259
259
 
260
- field.push({
260
+
261
+ if (!isSlash && data.content) {
262
+ fields.push({
263
+ name: "šŸ“ Content:",
264
+ value: `- ${data.content}`,
265
+ });
266
+ }
267
+
268
+ fields.push({
261
269
  name: "ā³ Date:",
262
270
  value: `<t:${Math.floor(Date.now() / 1000)}:F>`,
263
271
  });
264
272
 
273
+
265
274
  const embed = new EmbedBuilder()
266
275
  .setTitle(isSlash ? "šŸ“˜ Slash Command Log" : "šŸ“— Prefix Command Log")
267
- .setColor(isSlash ? "Green" : "Blue")
268
- .addFields(...field)
276
+ .setColor(isSlash ? "Blue" : "Blue")
277
+ .addFields(...fields)
269
278
  .setThumbnail(client.user.displayAvatarURL({ dynamic: true }))
270
279
  .setAuthor({
271
280
  name: `${user?.tag ?? "Unknown user"} || ${user?.username ?? "Unknown"}`,
272
281
  iconURL: user?.displayAvatarURL({ dynamic: true }),
273
282
  })
283
+ .setFooter({ text: "Command Logger", iconURL: client.user.displayAvatarURL() })
274
284
  .setTimestamp();
275
285
 
276
286
  try {
@@ -280,6 +290,9 @@ async function cmd_log(client, data, commandName, channelId) {
280
290
  }
281
291
  }
282
292
 
293
+
294
+
295
+
283
296
  //////////////////////////////////* Check update šŸ”¼
284
297
 
285
298
  async function update(client, id, webhookURL) {
@@ -222,7 +222,7 @@ async function starter(client, options) {
222
222
  //////////////////////////////////////////* slash run !////////////////////////////////////////////////////////
223
223
 
224
224
  client.on("interactionCreate", async (interaction) => {
225
- if (!interaction.isCommand()) return;
225
+ if (!interaction.isChatInputCommand()) return;
226
226
 
227
227
  const command = client.slashCommands.get(interaction.commandName);
228
228
  if (!command) return;
@@ -286,14 +286,7 @@ async function starter(client, options) {
286
286
  });
287
287
  }
288
288
 
289
- if (options.slash.log) {
290
- await cmd_log(
291
- client,
292
- interaction,
293
- interaction.commandName,
294
- options.slash.log
295
- );
296
- }
289
+
297
290
  try {
298
291
  if (typeof command.run === "function") {
299
292
  await command.run(interaction, client);
@@ -314,6 +307,16 @@ async function starter(client, options) {
314
307
  });
315
308
  }
316
309
  }
310
+
311
+
312
+ if (options.slash.log) {
313
+ await cmd_log(
314
+ client,
315
+ interaction,
316
+ interaction.commandName,
317
+ options.slash.log
318
+ );
319
+ }
317
320
  });
318
321
 
319
322
  if (anticrash) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  {
3
3
  "name": "djs-builder",
4
- "version": "0.6.13",
4
+ "version": "0.6.14",
5
5
  "description": "šŸŽ‰ Package Update! šŸ„\nNew features added:\n- `GetUser`: Easily fetch a user from **ID**, **mention**, or even from a **reply**.\n\nšŸ›  Fixes:\n- Minor bugs fixed\n- Improved stability and error handling\n\nšŸ”— Learn more on [NPM](https://www.npmjs.com/package/djs-builder)",
6
6
  "main": "handler/starter.js",
7
7
  "dependencies": {