Skip to content

Commit 6661b4c

Browse files
authored
Update interactionCreate.js
1 parent 3465ede commit 6661b4c

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

events/interactionCreate.js

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,24 @@ const client = require("../index");
44

55
client.on("interactionCreate", async (interaction) => {
66
if (interaction.isCommand()) {
7-
await interaction.deferReply({ ephemeral: false }).catch(() => {});
8-
9-
const command = client.slashCommands.get(interaction.commandName);
10-
if (!command) return interaction.followUp({ content: 'an Erorr' });
11-
12-
const args = [];
13-
14-
for (let option of interaction.options.data) {
15-
if (option.type === 'SUB_COMMAND') {
16-
if (option.name) args.push(option.name);
17-
option.options?.forEach(x => {
18-
if (x.value) args.push(x.value);
19-
});
20-
} else if (option.value) args.push(option.value);
21-
}
22-
23-
try {
24-
25-
command.run(client, interaction, args)
26-
27-
} catch (e) {
28-
29-
interaction.followUp({ content: e.message });
30-
31-
32-
}
7+
await interaction.deferReply({ ephemeral: false }).catch(() => {});
8+
9+
const command = client.slashCommands.get(interaction.commandName);
10+
if (!command) return interaction.followUp({ content: 'an Erorr' });
11+
12+
const args = [];
13+
14+
for (let option of interaction.options.data) {
15+
if (option.type === 'SUB_COMMAND') {
16+
if (option.name) args.push(option.name);
17+
option.options?.forEach(x => {
18+
if (x.value) args.push(x.value);
19+
});
20+
} else if (option.value) args.push(option.value);
21+
} try {
22+
command.run(client, interaction, args)
23+
} catch (e) {
24+
interaction.followUp({ content: e.message });
25+
}
3326
}
34-
});
27+
});

0 commit comments

Comments
 (0)