cordo 2.10.0-rc.3 → 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 +1 -1
- package/src/core/gateway.ts +0 -3
- package/src/core/hooks.ts +4 -2
- package/src/core/magic.ts +4 -0
- package/src/core/routing/respond.ts +3 -2
package/package.json
CHANGED
package/src/core/gateway.ts
CHANGED
|
@@ -209,7 +209,6 @@ export namespace CordoGateway {
|
|
|
209
209
|
}
|
|
210
210
|
// @ts-expect-error this type doesn't have a values property (yet)
|
|
211
211
|
i.data.values = values
|
|
212
|
-
console.log(values)
|
|
213
212
|
|
|
214
213
|
const id = i.data.custom_id
|
|
215
214
|
const parsedCustomId = FunctCompiler.parseCustomId(id)
|
|
@@ -230,7 +229,6 @@ export namespace CordoGateway {
|
|
|
230
229
|
//
|
|
231
230
|
|
|
232
231
|
async function parseAndEvokeModalLeafComponents(c: any, i: CordoInteraction, collectedFormItems: Map<string, unknown>): Promise<boolean> {
|
|
233
|
-
console.log(c)
|
|
234
232
|
if (c.type === ComponentType.ActionRow) {
|
|
235
233
|
for (const item of c.components) {
|
|
236
234
|
const success = await parseAndEvokeModalLeafComponents(item, i, collectedFormItems)
|
|
@@ -246,7 +244,6 @@ export namespace CordoGateway {
|
|
|
246
244
|
}
|
|
247
245
|
|
|
248
246
|
const parsedCustomId = FunctCompiler.parseCustomId(c.custom_id)
|
|
249
|
-
console.log(parsedCustomId)
|
|
250
247
|
if (!parsedCustomId.functs.length && !parsedCustomId.values.length)
|
|
251
248
|
return true
|
|
252
249
|
|
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
|
-
|
|
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
|
@@ -8,7 +8,6 @@ import { CordoGateway } from "../gateway"
|
|
|
8
8
|
import { FunctInternals } from "../../functions/funct"
|
|
9
9
|
import { goto, run } from "../../functions"
|
|
10
10
|
import { isModifier, readModifier } from "../../components/modifier"
|
|
11
|
-
import { FunctCompiler } from "../../functions/compiler"
|
|
12
11
|
import { RoutingResolve } from "./resolve"
|
|
13
12
|
|
|
14
13
|
|
|
@@ -40,10 +39,12 @@ export namespace RoutingRespond {
|
|
|
40
39
|
type = (InteractionInternals.get(i).answered && !opts.asReply)
|
|
41
40
|
? InteractionResponseType.UpdateMessage
|
|
42
41
|
: InteractionResponseType.ChannelMessageWithSource
|
|
43
|
-
} else if (i.type === InteractionType.MessageComponent
|
|
42
|
+
} else if (i.type === InteractionType.MessageComponent) {
|
|
44
43
|
type = opts.asReply
|
|
45
44
|
? InteractionResponseType.ChannelMessageWithSource
|
|
46
45
|
: InteractionResponseType.UpdateMessage
|
|
46
|
+
} else if (i.type === InteractionType.ModalSubmit) {
|
|
47
|
+
type = InteractionResponseType.ChannelMessageWithSource
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
CordoMagic.resetIdCounter()
|