djs-builder 0.6.6 → 0.6.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/handler/helper.js +12 -7
- package/handler/starter.js +4 -3
- package/package.json +1 -1
package/handler/helper.js
CHANGED
|
@@ -194,8 +194,8 @@ async function set_anticrash(data) {
|
|
|
194
194
|
async function cmd_log(client, data, commandName, channelId) {
|
|
195
195
|
const isSlash = !!data.user;
|
|
196
196
|
const user = isSlash ? data.user : data.author;
|
|
197
|
-
const channel = data.guild ? data.channel : "DM";
|
|
198
|
-
const messageUrl = data.message?.url || "
|
|
197
|
+
const channel = data.guild ? `Channel: ${data.channel.name} | ${data.channel} (${data.channel.id})\n Guild: ${data.guild.name} | (${data.guild.id})` : "DM";
|
|
198
|
+
const messageUrl = data.message?.url || "`not found`";
|
|
199
199
|
|
|
200
200
|
const logChannel = client.channels.cache.get(channelId);
|
|
201
201
|
if (!logChannel) return;
|
|
@@ -204,20 +204,25 @@ async function cmd_log(client, data, commandName, channelId) {
|
|
|
204
204
|
.setTitle(isSlash ? "📘 Slash Command Log" : "📗 Prefix Command Log")
|
|
205
205
|
.setColor(isSlash ? "Green" : "Blue")
|
|
206
206
|
.addFields(
|
|
207
|
-
{ name: "📝 Command", value: `\`${commandName}
|
|
207
|
+
{ name: "📝 Command", value: `\`${commandName}\`` },
|
|
208
208
|
{
|
|
209
209
|
name: "👤 User",
|
|
210
|
-
value: `${user.tag || user.username} (${user.id})`,
|
|
211
|
-
|
|
210
|
+
value: `${user.tag || user.username} | ${user} (${user.id})`,
|
|
211
|
+
|
|
212
212
|
},
|
|
213
|
-
{ name: "💬 Channel", value: `${channel}
|
|
214
|
-
{ name: "🔗 Message", value: `[Link](${messageUrl})
|
|
213
|
+
{ name: "💬 Channel", value: `${channel}` },
|
|
214
|
+
{ name: "🔗 Message", value: `[Link](${messageUrl})` },
|
|
215
215
|
{
|
|
216
216
|
name: "🕒 Date",
|
|
217
217
|
value: `<t:${Math.floor(Date.now() / 1000)}:F>`,
|
|
218
218
|
inline: true,
|
|
219
219
|
}
|
|
220
220
|
)
|
|
221
|
+
.setThumbnail(client.user.displayAvatarURL({ dynamic: true }))
|
|
222
|
+
.setAuthor({
|
|
223
|
+
name : `${user.tag} || ${user.username}`,
|
|
224
|
+
iconURL: user.displayAvatarURL({ dynamic: true }),
|
|
225
|
+
})
|
|
221
226
|
.setTimestamp();
|
|
222
227
|
|
|
223
228
|
logChannel.send({ embeds: [embed] }).catch(console.error);
|
package/handler/starter.js
CHANGED
|
@@ -78,7 +78,7 @@ async function starter(client, options) {
|
|
|
78
78
|
for (const file of prefix_files) {
|
|
79
79
|
const command = require(file.path);
|
|
80
80
|
|
|
81
|
-
if (!command.name
|
|
81
|
+
if (!command.name) continue;
|
|
82
82
|
|
|
83
83
|
const commandWithMeta = {
|
|
84
84
|
...command,
|
|
@@ -103,8 +103,9 @@ async function starter(client, options) {
|
|
|
103
103
|
const slash_files = await readFile(slash.path);
|
|
104
104
|
const validSlashCommands = slash_files
|
|
105
105
|
.map((f) => require(f.path))
|
|
106
|
-
.filter((cmd) => cmd.data && typeof cmd.run === "function");
|
|
106
|
+
.filter((cmd) => cmd.data && (typeof cmd.run === "function" || typeof cmd.execute === "function"));
|
|
107
107
|
|
|
108
|
+
|
|
108
109
|
client.slashCommands = new Map(
|
|
109
110
|
validSlashCommands.map((cmd) => [cmd.data.name, cmd])
|
|
110
111
|
);
|
|
@@ -283,7 +284,7 @@ async function starter(client, options) {
|
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
if (options.slash.log) {
|
|
286
|
-
await cmd_log(client, interaction,
|
|
287
|
+
await cmd_log(client, interaction, interaction.commandName, options.slash.log);
|
|
287
288
|
}
|
|
288
289
|
try {
|
|
289
290
|
if (typeof command.run === "function") {
|