cordo 2.10.0 → 2.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordo",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "A framework for handling complex discord api interactions",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
package/src/core/hooks.ts CHANGED
@@ -15,6 +15,9 @@ export namespace Hooks {
15
15
  config?: NonNullable<CordoConfig>
16
16
  ): ReturnType<NonNullable<CordoConfig['hooks'][Name]>> {
17
17
  if (!config) {
18
+ if (!CordoMagic.inContext())
19
+ return value as any
20
+
18
21
  const contextConfig = CordoMagic.getConfig()
19
22
  if (!contextConfig) {
20
23
  console.warn(`Calling hook '${hookName}' failed, no config provided and no config found in context.`)
@@ -26,8 +29,7 @@ export namespace Hooks {
26
29
 
27
30
  const hook = config.hooks[hookName]
28
31
  if (!hook)
29
- // @ts-expect-error
30
- return value
32
+ return value as any
31
33
 
32
34
  if (hookName === 'transformUserFacingText') {
33
35
  // @ts-expect-error
package/src/core/magic.ts CHANGED
@@ -31,6 +31,10 @@ export namespace CordoMagic {
31
31
 
32
32
  //
33
33
 
34
+ export function inContext() {
35
+ return !!als.getStore()
36
+ }
37
+
34
38
  export function getLockfile() {
35
39
  return Internals.getCtx().lockfile
36
40
  }