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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nv-kit",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Beginner-friendly Discord.js command handler with slash/prefix commands, cooldowns, permissions, and optional MongoDB.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -77,7 +77,7 @@ class EventHandler {
77
77
  continue
78
78
  }
79
79
 
80
- func(...arguments, instance)
80
+ func(instance, ...arguments)
81
81
  }
82
82
  })
83
83
  }
@@ -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 (interaction, instance) => {
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
- handleAutocomplete(interaction, commands)
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
- interaction.editReply(response).catch(() => {})
73
+ await interaction.editReply(response).catch(() => {})
74
74
  } else {
75
- interaction.reply(response).catch(() => {})
75
+ await interaction.reply(response).catch(() => {})
76
76
  }
77
77
  }
@@ -1,4 +1,4 @@
1
- module.exports = async (message, instance) => {
1
+ module.exports = async (instance, message) => {
2
2
  const { guild, content } = message
3
3
  const { commandHandler } = instance
4
4
  const { prefixHandler, commands, customCommands } = commandHandler
package/src/index.js CHANGED
@@ -92,7 +92,7 @@ class Main {
92
92
 
93
93
  async connectToMongo(mongoUri) {
94
94
  await mongoose.connect(mongoUri, {
95
- keepAlive: true,
95
+
96
96
  })
97
97
  }
98
98
  }