cordo 2.5.0 → 2.5.2

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.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "A framework for handling complex discord api interactions",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -12,8 +12,16 @@ type AllowedComponentArray
12
12
  export function row(...components: AllowedComponentArray | [ AllowedComponentArray ]) {
13
13
  if (Array.isArray(components[0]))
14
14
  components = components[0]
15
- return createComponent('ActionRow', ({ hirarchy, attributes }) => ({
16
- type: ComponentType.ActionRow,
17
- components: renderComponentList(components as AllowedComponentArray, 'ActionRow', hirarchy, attributes)
18
- }))
15
+
16
+ return createComponent('ActionRow', ({ hirarchy, attributes }) => {
17
+ const rendered = renderComponentList(components as AllowedComponentArray, 'ActionRow', hirarchy, attributes)
18
+ .filter(Boolean)
19
+ if (!rendered.length)
20
+ return null
21
+
22
+ return {
23
+ type: ComponentType.ActionRow,
24
+ components: rendered
25
+ }
26
+ })
19
27
  }
@@ -58,13 +58,11 @@ export namespace RoutingResolve {
58
58
 
59
59
  export function getRouteFromPath(path: string, resolveRuntimeVars: boolean) {
60
60
  const lockfile = CordoMagic.getLockfile()
61
- const currentRoute = CordoMagic.getCwd()
62
61
  const invoker = CordoMagic.getInvoker()
62
+ const currentRoute = CordoMagic.getCwd() ?? ''
63
63
 
64
64
  if (!lockfile)
65
65
  throw new MissingContextError('getRouteFromPath failed, no lockfile found in context.')
66
- if (!currentRoute)
67
- throw new MissingContextError('getRouteFromPath failed, no current route found in context.')
68
66
  if (!invoker)
69
67
  throw new MissingContextError('getRouteFromPath failed, no invoker found in context.')
70
68