@spatulox/discord-module 0.3.0 → 0.3.1
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/CHANGELOG.md +3 -0
- package/README.md +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
Date format : dd/mm/yyy
|
|
3
3
|
|
|
4
|
+
### 13/04/2026 - 0.3.1
|
|
5
|
+
- Update README.md : Add explanation for InteractionManager when passing class method when registering interactions
|
|
6
|
+
|
|
4
7
|
### 13/04/2026 - 0.3.0
|
|
5
8
|
- InteractionManager : adds support for prefix and suffix identifier matching
|
|
6
9
|
|
package/README.md
CHANGED
|
@@ -64,6 +64,14 @@ client.once(Events.ClientReady, () => {
|
|
|
64
64
|
|
|
65
65
|
// Register commands
|
|
66
66
|
interactionManager.registerSlash("ping", PongModule.pong_interaction)
|
|
67
|
+
|
|
68
|
+
// If you want to link a Method of a class
|
|
69
|
+
// This will crash because you only pass the method of the class, not the full class instance, so "randomBoolean" is undefined
|
|
70
|
+
interactionManager.registerButton("btn_randombool_accessor", new BtnModuleTest().testAccessor) // This test is here to try to acces a var in an instance of a class wich is undefined
|
|
71
|
+
// With a method of a class (which require a this.method() of this.var, you need to do it this way :
|
|
72
|
+
const classInstance = new BtnModuleTest() // Create the instance
|
|
73
|
+
interactionManager.registerButton("btn_randombool_accessor", (interaction: ButtonInteraction) => { return classInstance.testAccessor(interaction) }) // Pass an unknow func which call the class method with the instance
|
|
74
|
+
interactionManager.registerButton("btn_randombool_accessor", () => { return classInstance.testAccessorWithoutInteraction() })
|
|
67
75
|
});
|
|
68
76
|
```
|
|
69
77
|
|