nv-kit 1.0.4 → 1.0.5
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/package.json +1 -1
- package/src/event-handler/EventHandler.js +1 -1
- package/src/event-handler/events/interactionCreate/index.js +20 -0
- package/src/event-handler/events/interactionCreate/isCommand/slash-commands.js +4 -4
- package/src/event-handler/events/messageCreate/isHuman/legacy-commands.js +1 -1
- package/src/index.js +1 -1
- /package/src/event-handler/events/interactionCreate/isButton/{test.js → index.js} +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = async (instance, interaction) => {
|
|
2
|
+
try {
|
|
3
|
+
if (interaction.isButton()) {
|
|
4
|
+
const handleButton = require("./isButton/test")
|
|
5
|
+
return await handleButton(instance, interaction)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (interaction.isChatInputCommand() || interaction.isAutocomplete()) {
|
|
9
|
+
const handleSlash = require("./isCommand/slash-commands")
|
|
10
|
+
return await handleSlash(instance, interaction)
|
|
11
|
+
}
|
|
12
|
+
} catch (err) {
|
|
13
|
+
console.error("[nv-kit] interactionCreate error:", err)
|
|
14
|
+
if (!interaction?.replied && !interaction?.deferred) {
|
|
15
|
+
await interaction
|
|
16
|
+
?.reply?.({ content: "Something went wrong.", ephemeral: true })
|
|
17
|
+
.catch(() => {})
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -28,12 +28,12 @@ const handleAutocomplete = async (interaction, commands) => {
|
|
|
28
28
|
)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
module.exports = async (
|
|
31
|
+
module.exports = async (instance, interaction) => {
|
|
32
32
|
const { commandHandler } = instance
|
|
33
33
|
const { commands, customCommands } = commandHandler
|
|
34
34
|
|
|
35
35
|
if (interaction.type === InteractionType.ApplicationCommandAutocomplete) {
|
|
36
|
-
|
|
36
|
+
await handleAutocomplete(interaction, commands)
|
|
37
37
|
return
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -70,8 +70,8 @@ module.exports = async (interaction, instance) => {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
if (deferReply) {
|
|
73
|
-
|
|
73
|
+
await interaction.editReply(response).catch(() => {})
|
|
74
74
|
} else {
|
|
75
|
-
|
|
75
|
+
await interaction.reply(response).catch(() => {})
|
|
76
76
|
}
|
|
77
77
|
}
|
package/src/index.js
CHANGED
|
File without changes
|