cordo 2.18.1 → 2.19.0
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 +23 -9
- package/src/components/builtin/button.ts +8 -8
- package/src/components/builtin/checkbox-group.ts +6 -6
- package/src/components/builtin/collection.ts +1 -1
- package/src/components/builtin/container.ts +2 -2
- package/src/components/builtin/divider.ts +2 -2
- package/src/components/builtin/file-upload.ts +5 -5
- package/src/components/builtin/gallery.ts +1 -1
- package/src/components/builtin/image.ts +1 -1
- package/src/components/builtin/link-button.ts +5 -5
- package/src/components/builtin/modal.ts +6 -6
- package/src/components/builtin/radio-group.ts +6 -6
- package/src/components/builtin/row.ts +1 -1
- package/src/components/builtin/section.ts +1 -1
- package/src/components/builtin/select-string.ts +7 -7
- package/src/components/builtin/sku-button.ts +2 -2
- package/src/components/builtin/spacer.ts +2 -2
- package/src/components/builtin/text-input.ts +5 -5
- package/src/components/builtin/text.ts +3 -3
- package/src/core/routing/resolve.ts +1 -1
- package/src/errors/cordo-error.ts +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "A framework for handling complex discord api interactions",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"lint": "eslint --ext .ts --ignore-path .gitignore src/**/*.ts",
|
|
25
25
|
"tunnel": "cloudflared tunnel --config ~/.cloudflared/config.yml run fsb",
|
|
26
26
|
"dev": "tsc && node --trace-warnings ./build/index.js",
|
|
27
|
-
"test": "
|
|
27
|
+
"test": "bun test",
|
|
28
28
|
"prepub": "npm run lint && npm run build && npm run test && npm pub"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
@@ -38,25 +38,39 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/maanex/cordo#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"
|
|
42
|
-
"axios": "^0.21.4",
|
|
41
|
+
"axios": "^1.8.4",
|
|
43
42
|
"defu": "^6.1.7",
|
|
43
|
+
"discord-api-types": "^0.38.57",
|
|
44
44
|
"discord-interactions": "^2.4.1",
|
|
45
45
|
"type-fest": "^4.41.0"
|
|
46
46
|
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"discord.js": "^14.0.0",
|
|
49
|
+
"express": "^4.0.0 || ^5.0.0",
|
|
50
|
+
"hono": "^4.0.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"discord.js": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"express": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"hono": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
47
63
|
"devDependencies": {
|
|
48
|
-
"@types/
|
|
64
|
+
"@types/bun": "^1.4.4",
|
|
49
65
|
"@types/express": "^4.17.25",
|
|
50
|
-
"@types/node": "^
|
|
66
|
+
"@types/node": "^22.13.0",
|
|
51
67
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
52
68
|
"@typescript-eslint/parser": "^4.33.0",
|
|
53
|
-
"discord-api-types": "^0.38.57",
|
|
54
69
|
"discord.js": "^14.27.0",
|
|
55
70
|
"eslint": "^7.32.0",
|
|
56
71
|
"eslint-config-maanex": "^1.3.3",
|
|
57
72
|
"express": "^4.22.3",
|
|
58
|
-
"hono": "^4.13.
|
|
59
|
-
"reflect-metadata": "^0.1.14",
|
|
73
|
+
"hono": "^4.13.14",
|
|
60
74
|
"typescript": "^5.9.3",
|
|
61
75
|
"vitepress": "^1.6.4",
|
|
62
76
|
"vue": "^3.5.44"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ButtonStyle, type APIEmoji } from
|
|
2
|
-
import { ComponentType, createComponent } from
|
|
3
|
-
import { LibEmoji } from
|
|
4
|
-
import { Hooks } from
|
|
5
|
-
import type { CordoFunct, CordoFunctRun } from
|
|
6
|
-
import { FunctCompiler } from
|
|
7
|
-
import { MaxLengthConstants } from
|
|
8
|
-
import { CordoMagic } from
|
|
1
|
+
import { ButtonStyle, type APIEmoji } from 'discord-api-types/v10'
|
|
2
|
+
import { ComponentType, createComponent } from '../component'
|
|
3
|
+
import { LibEmoji } from '../../lib/emoji'
|
|
4
|
+
import { Hooks } from '../../core/hooks'
|
|
5
|
+
import type { CordoFunct, CordoFunctRun } from '../../functions'
|
|
6
|
+
import { FunctCompiler } from '../../functions/compiler'
|
|
7
|
+
import { MaxLengthConstants } from '../../lib/constants'
|
|
8
|
+
import { CordoMagic } from '../../core/magic'
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
export function button() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ComponentType, createComponent } from
|
|
2
|
-
import { Hooks } from
|
|
3
|
-
import { value, type CordoFunct, type CordoFunctRun } from
|
|
4
|
-
import { FunctCompiler } from
|
|
5
|
-
import { MaxLengthConstants } from
|
|
6
|
-
import { CordoMagic } from
|
|
1
|
+
import { ComponentType, createComponent } from '../component'
|
|
2
|
+
import { Hooks } from '../../core/hooks'
|
|
3
|
+
import { value, type CordoFunct, type CordoFunctRun } from '../../functions'
|
|
4
|
+
import { FunctCompiler } from '../../functions/compiler'
|
|
5
|
+
import { MaxLengthConstants } from '../../lib/constants'
|
|
6
|
+
import { CordoMagic } from '../../core/magic'
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
type CheckboxGroupOption<Value extends string = string> = ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentType, createComponent, renderComponentList, type CordoComponent } from
|
|
2
|
-
import type { CordoModifier } from
|
|
1
|
+
import { ComponentType, createComponent, renderComponentList, type CordoComponent } from '../component'
|
|
2
|
+
import type { CordoModifier } from '../modifier'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export type AllowedComponents = CordoComponent<'ActionRow' | 'Button' | 'TextDisplay' | 'Section' | 'MediaGallery' | 'Seperator' | 'File' | 'StringSelect'> | CordoModifier
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, createComponent } from
|
|
1
|
+
import { ComponentType, createComponent } from '../component'
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export function divider() {
|
|
@@ -20,6 +20,6 @@ export function divider() {
|
|
|
20
20
|
return out
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
return out
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ComponentType, createComponent } from
|
|
2
|
-
import { Hooks } from
|
|
3
|
-
import { value, type CordoFunct, type CordoFunctRun } from
|
|
4
|
-
import { FunctCompiler } from
|
|
5
|
-
import { CordoMagic } from
|
|
1
|
+
import { ComponentType, createComponent } from '../component'
|
|
2
|
+
import { Hooks } from '../../core/hooks'
|
|
3
|
+
import { value, type CordoFunct, type CordoFunctRun } from '../../functions'
|
|
4
|
+
import { FunctCompiler } from '../../functions/compiler'
|
|
5
|
+
import { CordoMagic } from '../../core/magic'
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export function fileUpload() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, createComponent, renderComponentList, type CordoComponent } from
|
|
1
|
+
import { ComponentType, createComponent, renderComponentList, type CordoComponent } from '../component'
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export function gallery(...items: CordoComponent<'Thumbnail'>[]) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { URL } from
|
|
2
|
-
import { ButtonStyle } from
|
|
3
|
-
import { ComponentType, createComponent } from
|
|
4
|
-
import { Hooks } from
|
|
5
|
-
import { MaxLengthConstants } from
|
|
1
|
+
import { URL } from 'node:url'
|
|
2
|
+
import { ButtonStyle } from 'discord-api-types/v10'
|
|
3
|
+
import { ComponentType, createComponent } from '../component'
|
|
4
|
+
import { Hooks } from '../../core/hooks'
|
|
5
|
+
import { MaxLengthConstants } from '../../lib/constants'
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export function linkButton(url: string) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Hooks } from
|
|
2
|
-
import { CordoMagic } from
|
|
3
|
-
import type { CordoFunct, CordoFunctRun } from
|
|
4
|
-
import { FunctCompiler } from
|
|
5
|
-
import { ComponentType, createComponent, renderComponent, renderComponentList, type CordoComponent, type CordoComponentPayload, type StringComponentType } from
|
|
6
|
-
import type { CordoModifier } from
|
|
1
|
+
import { Hooks } from '../../core/hooks'
|
|
2
|
+
import { CordoMagic } from '../../core/magic'
|
|
3
|
+
import type { CordoFunct, CordoFunctRun } from '../../functions'
|
|
4
|
+
import { FunctCompiler } from '../../functions/compiler'
|
|
5
|
+
import { ComponentType, createComponent, renderComponent, renderComponentList, type CordoComponent, type CordoComponentPayload, type StringComponentType } from '../component'
|
|
6
|
+
import type { CordoModifier } from '../modifier'
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export type AllowedComponents = CordoComponent<'TextDisplay' | 'TextInput' | 'RoleSelect' | 'UserSelect' | 'StringSelect' | 'ChannelSelect' | 'MentionableSelect' | 'Label' | 'FileUpload' | 'RadioGroup' | 'CheckboxGroup' | 'Checkbox'> | CordoModifier
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ComponentType, createComponent } from
|
|
2
|
-
import { Hooks } from
|
|
3
|
-
import { value, type CordoFunct, type CordoFunctRun } from
|
|
4
|
-
import { FunctCompiler } from
|
|
5
|
-
import { MaxLengthConstants } from
|
|
6
|
-
import { CordoMagic } from
|
|
1
|
+
import { ComponentType, createComponent } from '../component'
|
|
2
|
+
import { Hooks } from '../../core/hooks'
|
|
3
|
+
import { value, type CordoFunct, type CordoFunctRun } from '../../functions'
|
|
4
|
+
import { FunctCompiler } from '../../functions/compiler'
|
|
5
|
+
import { MaxLengthConstants } from '../../lib/constants'
|
|
6
|
+
import { CordoMagic } from '../../core/magic'
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
type RadioGroupOption<Value extends string = string> = ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, createComponent, renderComponentList, type CordoComponent } from
|
|
1
|
+
import { ComponentType, createComponent, renderComponentList, type CordoComponent } from '../component'
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
type AllowedComponents = CordoComponent<'Button' | 'StringSelect'>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, createComponent, renderComponent, renderComponentList, type CordoComponent } from
|
|
1
|
+
import { ComponentType, createComponent, renderComponent, renderComponentList, type CordoComponent } from '../component'
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
type AllowedComponentsContent = CordoComponent<'TextDisplay'>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type APISelectMenuOption } from
|
|
2
|
-
import { ComponentType, createComponent } from
|
|
3
|
-
import { Hooks } from
|
|
4
|
-
import { value, type CordoFunct, type CordoFunctRun } from
|
|
5
|
-
import { FunctCompiler } from
|
|
6
|
-
import { MaxLengthConstants } from
|
|
7
|
-
import { CordoMagic } from
|
|
1
|
+
import { type APISelectMenuOption } from 'discord-api-types/v10'
|
|
2
|
+
import { ComponentType, createComponent } from '../component'
|
|
3
|
+
import { Hooks } from '../../core/hooks'
|
|
4
|
+
import { value, type CordoFunct, type CordoFunctRun } from '../../functions'
|
|
5
|
+
import { FunctCompiler } from '../../functions/compiler'
|
|
6
|
+
import { MaxLengthConstants } from '../../lib/constants'
|
|
7
|
+
import { CordoMagic } from '../../core/magic'
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
type SelectMenuOption<Value extends string = string> = Omit<APISelectMenuOption, 'value'> & ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ButtonStyle } from
|
|
2
|
-
import { ComponentType, createComponent } from
|
|
1
|
+
import { ButtonStyle } from 'discord-api-types/v10'
|
|
2
|
+
import { ComponentType, createComponent } from '../component'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export function skuButton(skuId: string) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ComponentType, createComponent } from
|
|
2
|
-
import { Hooks } from
|
|
3
|
-
import { FunctCompiler } from
|
|
4
|
-
import { value } from
|
|
5
|
-
import { CordoMagic } from
|
|
1
|
+
import { ComponentType, createComponent } from '../component'
|
|
2
|
+
import { Hooks } from '../../core/hooks'
|
|
3
|
+
import { FunctCompiler } from '../../functions/compiler'
|
|
4
|
+
import { value } from '../../functions'
|
|
5
|
+
import { CordoMagic } from '../../core/magic'
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export function textInput() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Hooks } from
|
|
2
|
-
import { ComponentType, createComponent } from
|
|
1
|
+
import { Hooks } from '../../core/hooks'
|
|
2
|
+
import { ComponentType, createComponent } from '../component'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export function text(...content: Array<string | { toString: () => string }>) {
|
|
@@ -89,6 +89,6 @@ export function text(...content: Array<string | { toString: () => string }>) {
|
|
|
89
89
|
return out
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
return out
|
|
94
94
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationCommandOptionType, ApplicationCommandType, InteractionType } from 'discord
|
|
1
|
+
import { ApplicationCommandOptionType, ApplicationCommandType, InteractionType } from 'discord-api-types/v10'
|
|
2
2
|
import { MissingContextError } from '../../errors/builtin/missing-context'
|
|
3
3
|
import { FunctCompiler } from '../../functions/compiler'
|
|
4
4
|
import { Hooks } from '../hooks'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { container } from '../components/builtin/container'
|
|
2
|
+
import { text } from '../components/builtin/text'
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
export class CordoError extends Error {
|
|
@@ -11,9 +12,9 @@ export class CordoError extends Error {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
public render() {
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
return container(
|
|
16
|
+
text('Error:', this.name).size('h2'),
|
|
17
|
+
text(this.message)
|
|
17
18
|
)
|
|
18
19
|
}
|
|
19
20
|
|