yuzuha 0.2.0 → 0.3.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/CHANGELOG.md +29 -1
- package/README.md +22 -14
- package/VERSIONING.md +56 -7
- package/benchmarks/parser.mjs +1 -1
- package/benchmarks/run.mjs +3 -2
- package/dist/canvas/card.d.ts +10 -0
- package/dist/canvas/card.d.ts.map +1 -0
- package/dist/canvas/card.js +11 -0
- package/dist/canvas/card.js.map +1 -0
- package/dist/canvas.d.ts +30 -9
- package/dist/canvas.d.ts.map +1 -1
- package/dist/canvas.js +64 -9
- package/dist/canvas.js.map +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +2 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +1 -2
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +8 -9
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/scaffold.js +1 -1
- package/dist/cli/scaffold.js.map +1 -1
- package/dist/cli/scenarios.d.ts.map +1 -1
- package/dist/cli/scenarios.js +2 -1
- package/dist/cli/scenarios.js.map +1 -1
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +7 -2
- package/dist/commands/context.js.map +1 -1
- package/dist/domain/resource-batches.d.ts +6 -0
- package/dist/domain/resource-batches.d.ts.map +1 -1
- package/dist/domain/resource-batches.js +31 -0
- package/dist/domain/resource-batches.js.map +1 -1
- package/dist/framework/bot.d.ts +9 -5
- package/dist/framework/bot.d.ts.map +1 -1
- package/dist/framework/bot.js +51 -27
- package/dist/framework/bot.js.map +1 -1
- package/dist/framework/command-registry.d.ts +8 -7
- package/dist/framework/command-registry.d.ts.map +1 -1
- package/dist/framework/command-registry.js +14 -11
- package/dist/framework/command-registry.js.map +1 -1
- package/dist/framework/options.d.ts +3 -3
- package/dist/framework/options.d.ts.map +1 -1
- package/dist/framework/options.js.map +1 -1
- package/dist/{scripting → functions}/builtins/arguments.d.ts.map +1 -1
- package/dist/{scripting → functions}/builtins/arguments.js.map +1 -1
- package/dist/functions/builtins/canvas.d.ts +2 -0
- package/dist/functions/builtins/canvas.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/canvas.js +1 -1
- package/dist/{scripting → functions}/builtins/canvas.js.map +1 -1
- package/dist/functions/builtins/context.d.ts +2 -0
- package/dist/functions/builtins/context.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/context.js.map +1 -1
- package/dist/{scripting → functions}/builtins/definition.d.ts +1 -1
- package/dist/functions/builtins/definition.d.ts.map +1 -0
- package/dist/functions/builtins/definition.js.map +1 -0
- package/dist/functions/builtins/embeds.d.ts +3 -0
- package/dist/{scripting → functions}/builtins/embeds.d.ts.map +1 -1
- package/dist/{scripting → functions}/builtins/embeds.js +1 -1
- package/dist/functions/builtins/embeds.js.map +1 -0
- package/dist/functions/builtins/events.d.ts +2 -0
- package/dist/functions/builtins/events.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/events.js.map +1 -1
- package/dist/functions/builtins/flow.d.ts +2 -0
- package/dist/functions/builtins/flow.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/flow.js +2 -2
- package/dist/functions/builtins/flow.js.map +1 -0
- package/dist/functions/builtins/guards.d.ts +2 -0
- package/dist/functions/builtins/guards.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/guards.js +1 -1
- package/dist/functions/builtins/guards.js.map +1 -0
- package/dist/functions/builtins/http.d.ts +2 -0
- package/dist/functions/builtins/http.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/http.js +2 -2
- package/dist/functions/builtins/http.js.map +1 -0
- package/dist/functions/builtins/index.d.ts +5 -0
- package/dist/functions/builtins/index.d.ts.map +1 -0
- package/dist/functions/builtins/index.js.map +1 -0
- package/dist/functions/builtins/language/array-callbacks.d.ts +2 -0
- package/dist/functions/builtins/language/array-callbacks.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/language/array-callbacks.js +1 -1
- package/dist/{scripting → functions}/builtins/language/array-callbacks.js.map +1 -1
- package/dist/functions/builtins/language/arrays.d.ts +2 -0
- package/dist/functions/builtins/language/arrays.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/language/arrays.js +1 -1
- package/dist/{scripting → functions}/builtins/language/arrays.js.map +1 -1
- package/dist/{scripting → functions}/builtins/language/common.d.ts.map +1 -1
- package/dist/{scripting → functions}/builtins/language/common.js.map +1 -1
- package/dist/functions/builtins/language/decimals.d.ts +2 -0
- package/dist/functions/builtins/language/decimals.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/language/decimals.js.map +1 -1
- package/dist/functions/builtins/language/index.d.ts +3 -0
- package/dist/functions/builtins/language/index.d.ts.map +1 -0
- package/dist/functions/builtins/language/index.js.map +1 -0
- package/dist/functions/builtins/language/loops.d.ts +4 -0
- package/dist/{scripting → functions}/builtins/language/loops.d.ts.map +1 -1
- package/dist/{scripting → functions}/builtins/language/loops.js +3 -3
- package/dist/{scripting → functions}/builtins/language/loops.js.map +1 -1
- package/dist/functions/builtins/language/numbers.d.ts +2 -0
- package/dist/functions/builtins/language/numbers.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/language/numbers.js.map +1 -1
- package/dist/{scripting → functions}/builtins/language/objects.d.ts +1 -1
- package/dist/{scripting → functions}/builtins/language/objects.d.ts.map +1 -1
- package/dist/{scripting → functions}/builtins/language/objects.js.map +1 -1
- package/dist/functions/builtins/language/regex.d.ts +2 -0
- package/dist/functions/builtins/language/regex.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/language/regex.js +1 -1
- package/dist/{scripting → functions}/builtins/language/regex.js.map +1 -1
- package/dist/functions/builtins/language/sort.d.ts +2 -0
- package/dist/functions/builtins/language/sort.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/language/sort.js.map +1 -1
- package/dist/{scripting → functions}/builtins/language/state.d.ts +1 -1
- package/dist/{scripting → functions}/builtins/language/state.d.ts.map +1 -1
- package/dist/{scripting → functions}/builtins/language/state.js.map +1 -1
- package/dist/functions/builtins/language/texts.d.ts +2 -0
- package/dist/functions/builtins/language/texts.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/language/texts.js.map +1 -1
- package/dist/functions/builtins/messages.d.ts +2 -0
- package/dist/functions/builtins/messages.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/messages.js.map +1 -1
- package/dist/functions/builtins/moderation.d.ts +2 -0
- package/dist/functions/builtins/moderation.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/moderation.js.map +1 -1
- package/dist/functions/builtins/native-channels.d.ts +2 -0
- package/dist/functions/builtins/native-channels.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-channels.js.map +1 -1
- package/dist/functions/builtins/native-collectors.d.ts +2 -0
- package/dist/functions/builtins/native-collectors.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-collectors.js.map +1 -1
- package/dist/functions/builtins/native-expressions.d.ts +2 -0
- package/dist/functions/builtins/native-expressions.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-expressions.js.map +1 -1
- package/dist/functions/builtins/native-invites.d.ts +2 -0
- package/dist/functions/builtins/native-invites.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-invites.js.map +1 -1
- package/dist/functions/builtins/native-messages.d.ts +2 -0
- package/dist/functions/builtins/native-messages.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-messages.js.map +1 -1
- package/dist/functions/builtins/native-roles.d.ts +2 -0
- package/dist/functions/builtins/native-roles.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-roles.js.map +1 -1
- package/dist/functions/builtins/native-threads.d.ts +2 -0
- package/dist/functions/builtins/native-threads.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-threads.js.map +1 -1
- package/dist/functions/builtins/native-users.d.ts +2 -0
- package/dist/functions/builtins/native-users.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-users.js.map +1 -1
- package/dist/functions/builtins/native-webhooks.d.ts +2 -0
- package/dist/functions/builtins/native-webhooks.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/native-webhooks.js.map +1 -1
- package/dist/{scripting → functions}/builtins/payload.d.ts +2 -2
- package/dist/functions/builtins/payload.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/payload.js +1 -1
- package/dist/functions/builtins/payload.js.map +1 -0
- package/dist/functions/builtins/resource-extras.d.ts +2 -0
- package/dist/functions/builtins/resource-extras.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/resource-extras.js.map +1 -1
- package/dist/functions/builtins/schedule.d.ts +2 -0
- package/dist/functions/builtins/schedule.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/schedule.js.map +1 -1
- package/dist/functions/builtins/storage.d.ts +2 -0
- package/dist/functions/builtins/storage.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/storage.js.map +1 -1
- package/dist/functions/builtins/values.d.ts +2 -0
- package/dist/functions/builtins/values.d.ts.map +1 -0
- package/dist/{scripting → functions}/builtins/values.js +1 -1
- package/dist/functions/builtins/values.js.map +1 -0
- package/dist/functions/runtime/ast.d.ts.map +1 -0
- package/dist/functions/runtime/ast.js.map +1 -0
- package/dist/{scripting → functions/runtime}/canvas-execution.d.ts +1 -1
- package/dist/functions/runtime/canvas-execution.d.ts.map +1 -0
- package/dist/functions/runtime/canvas-execution.js.map +1 -0
- package/dist/functions/runtime/control-flow.d.ts.map +1 -0
- package/dist/functions/runtime/control-flow.js.map +1 -0
- package/dist/{scripting → functions/runtime}/evaluator.d.ts +1 -1
- package/dist/functions/runtime/evaluator.d.ts.map +1 -0
- package/dist/{scripting → functions/runtime}/evaluator.js +1 -1
- package/dist/functions/runtime/evaluator.js.map +1 -0
- package/dist/functions/runtime/limits.d.ts.map +1 -0
- package/dist/{scripting → functions/runtime}/limits.js +1 -1
- package/dist/functions/runtime/limits.js.map +1 -0
- package/dist/functions/runtime/parser.d.ts.map +1 -0
- package/dist/{scripting → functions/runtime}/parser.js +1 -1
- package/dist/functions/runtime/parser.js.map +1 -0
- package/dist/functions/runtime/regex.d.ts.map +1 -0
- package/dist/{scripting → functions/runtime}/regex.js +1 -1
- package/dist/functions/runtime/regex.js.map +1 -0
- package/dist/functions/runtime/registry.d.ts.map +1 -0
- package/dist/{scripting → functions/runtime}/registry.js +1 -1
- package/dist/functions/runtime/registry.js.map +1 -0
- package/dist/{scripting → functions/runtime}/runtime.d.ts +3 -1
- package/dist/functions/runtime/runtime.d.ts.map +1 -0
- package/dist/{scripting → functions/runtime}/runtime.js +3 -0
- package/dist/functions/runtime/runtime.js.map +1 -0
- package/dist/{scripting → functions/runtime}/types.d.ts +1 -1
- package/dist/functions/runtime/types.d.ts.map +1 -0
- package/dist/functions/runtime/types.js.map +1 -0
- package/dist/functions/runtime/values.d.ts.map +1 -0
- package/dist/functions/runtime/values.js.map +1 -0
- package/dist/functions.d.ts +19 -8
- package/dist/functions.d.ts.map +1 -1
- package/dist/functions.js +18 -6
- package/dist/functions.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/canvas/napi.d.ts +4 -0
- package/dist/infrastructure/canvas/napi.d.ts.map +1 -0
- package/dist/infrastructure/canvas/napi.js +17 -0
- package/dist/infrastructure/canvas/napi.js.map +1 -0
- package/dist/infrastructure/fluxer/resources/cache.d.ts +4 -0
- package/dist/infrastructure/fluxer/resources/cache.d.ts.map +1 -0
- package/dist/infrastructure/fluxer/resources/cache.js +68 -0
- package/dist/infrastructure/fluxer/resources/cache.js.map +1 -0
- package/dist/infrastructure/fluxer/resources/channels.d.ts +3 -2
- package/dist/infrastructure/fluxer/resources/channels.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/channels.js +54 -2
- package/dist/infrastructure/fluxer/resources/channels.js.map +1 -1
- package/dist/infrastructure/fluxer/resources/collectors.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/collectors.js +86 -4
- package/dist/infrastructure/fluxer/resources/collectors.js.map +1 -1
- package/dist/infrastructure/fluxer/resources/expressions.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/expressions.js +8 -1
- package/dist/infrastructure/fluxer/resources/expressions.js.map +1 -1
- package/dist/infrastructure/fluxer/resources/gateway.d.ts +4 -0
- package/dist/infrastructure/fluxer/resources/gateway.d.ts.map +1 -0
- package/dist/infrastructure/fluxer/resources/gateway.js +31 -0
- package/dist/infrastructure/fluxer/resources/gateway.js.map +1 -0
- package/dist/infrastructure/fluxer/resources/instance.d.ts +4 -0
- package/dist/infrastructure/fluxer/resources/instance.d.ts.map +1 -0
- package/dist/infrastructure/fluxer/resources/instance.js +96 -0
- package/dist/infrastructure/fluxer/resources/instance.js.map +1 -0
- package/dist/infrastructure/fluxer/resources/messages.d.ts +3 -1
- package/dist/infrastructure/fluxer/resources/messages.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/messages.js +91 -36
- package/dist/infrastructure/fluxer/resources/messages.js.map +1 -1
- package/dist/infrastructure/fluxer/resources/roles.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/roles.js +8 -0
- package/dist/infrastructure/fluxer/resources/roles.js.map +1 -1
- package/dist/infrastructure/fluxer/resources/self.d.ts +4 -0
- package/dist/infrastructure/fluxer/resources/self.d.ts.map +1 -0
- package/dist/infrastructure/fluxer/resources/self.js +36 -0
- package/dist/infrastructure/fluxer/resources/self.js.map +1 -0
- package/dist/infrastructure/fluxer/resources/threads.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/threads.js +15 -0
- package/dist/infrastructure/fluxer/resources/threads.js.map +1 -1
- package/dist/infrastructure/fluxer/resources/users.d.ts +5 -2
- package/dist/infrastructure/fluxer/resources/users.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/users.js +36 -3
- package/dist/infrastructure/fluxer/resources/users.js.map +1 -1
- package/dist/infrastructure/fluxer/resources/webhooks.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources/webhooks.js +9 -0
- package/dist/infrastructure/fluxer/resources/webhooks.js.map +1 -1
- package/dist/infrastructure/fluxer/resources.d.ts +4 -0
- package/dist/infrastructure/fluxer/resources.d.ts.map +1 -1
- package/dist/infrastructure/fluxer/resources.js +12 -0
- package/dist/infrastructure/fluxer/resources.js.map +1 -1
- package/dist/ports/resources/cache.d.ts +74 -0
- package/dist/ports/resources/cache.d.ts.map +1 -0
- package/dist/ports/resources/cache.js +2 -0
- package/dist/ports/resources/cache.js.map +1 -0
- package/dist/ports/resources/channels.d.ts +17 -0
- package/dist/ports/resources/channels.d.ts.map +1 -1
- package/dist/ports/resources/channels.js.map +1 -1
- package/dist/ports/resources/collectors.d.ts +18 -0
- package/dist/ports/resources/collectors.d.ts.map +1 -1
- package/dist/ports/resources/collectors.js.map +1 -1
- package/dist/ports/resources/common.d.ts +2 -0
- package/dist/ports/resources/common.d.ts.map +1 -1
- package/dist/ports/resources/common.js.map +1 -1
- package/dist/ports/resources/expressions.d.ts +8 -0
- package/dist/ports/resources/expressions.d.ts.map +1 -1
- package/dist/ports/resources/expressions.js.map +1 -1
- package/dist/ports/resources/gateway.d.ts +48 -0
- package/dist/ports/resources/gateway.d.ts.map +1 -0
- package/dist/ports/resources/gateway.js +2 -0
- package/dist/ports/resources/gateway.js.map +1 -0
- package/dist/ports/resources/instance.d.ts +101 -0
- package/dist/ports/resources/instance.d.ts.map +1 -0
- package/dist/ports/resources/instance.js +2 -0
- package/dist/ports/resources/instance.js.map +1 -0
- package/dist/ports/resources/messages.d.ts +27 -0
- package/dist/ports/resources/messages.d.ts.map +1 -1
- package/dist/ports/resources/messages.js.map +1 -1
- package/dist/ports/resources/roles.d.ts +6 -0
- package/dist/ports/resources/roles.d.ts.map +1 -1
- package/dist/ports/resources/roles.js.map +1 -1
- package/dist/ports/resources/self.d.ts +30 -0
- package/dist/ports/resources/self.d.ts.map +1 -0
- package/dist/ports/resources/self.js +2 -0
- package/dist/ports/resources/self.js.map +1 -0
- package/dist/ports/resources/threads.d.ts +16 -0
- package/dist/ports/resources/threads.d.ts.map +1 -1
- package/dist/ports/resources/threads.js.map +1 -1
- package/dist/ports/resources/users.d.ts +30 -0
- package/dist/ports/resources/users.d.ts.map +1 -1
- package/dist/ports/resources/users.js.map +1 -1
- package/dist/ports/resources/webhooks.d.ts +5 -0
- package/dist/ports/resources/webhooks.d.ts.map +1 -1
- package/dist/ports/resources/webhooks.js.map +1 -1
- package/dist/ports/resources.d.ts +8 -0
- package/dist/ports/resources.d.ts.map +1 -1
- package/dist/ports/resources.js.map +1 -1
- package/dist/ports/script-engine.d.ts +45 -0
- package/dist/ports/script-engine.d.ts.map +1 -0
- package/dist/ports/script-engine.js +2 -0
- package/dist/ports/script-engine.js.map +1 -0
- package/dist/sdk/builders.d.ts +2 -0
- package/dist/sdk/builders.d.ts.map +1 -0
- package/dist/sdk/builders.js +2 -0
- package/dist/sdk/builders.js.map +1 -0
- package/dist/sdk/client.d.ts +2 -0
- package/dist/sdk/client.d.ts.map +1 -0
- package/dist/sdk/client.js +2 -0
- package/dist/sdk/client.js.map +1 -0
- package/dist/sdk/cluster.d.ts +2 -0
- package/dist/sdk/cluster.d.ts.map +1 -0
- package/dist/sdk/cluster.js +2 -0
- package/dist/sdk/cluster.js.map +1 -0
- package/dist/sdk/collection.d.ts +2 -0
- package/dist/sdk/collection.d.ts.map +1 -0
- package/dist/sdk/collection.js +2 -0
- package/dist/sdk/collection.js.map +1 -0
- package/dist/sdk/errors.d.ts +2 -0
- package/dist/sdk/errors.d.ts.map +1 -0
- package/dist/sdk/errors.js +2 -0
- package/dist/sdk/errors.js.map +1 -0
- package/dist/sdk/internal.d.ts +2 -0
- package/dist/sdk/internal.d.ts.map +1 -0
- package/dist/sdk/internal.js +2 -0
- package/dist/sdk/internal.js.map +1 -0
- package/dist/sdk/message.d.ts +2 -0
- package/dist/sdk/message.d.ts.map +1 -0
- package/dist/sdk/message.js +2 -0
- package/dist/sdk/message.js.map +1 -0
- package/dist/sdk/rest/request-manager.d.ts +2 -0
- package/dist/sdk/rest/request-manager.d.ts.map +1 -0
- package/dist/sdk/rest/request-manager.js +2 -0
- package/dist/sdk/rest/request-manager.js.map +1 -0
- package/dist/sdk/rest.d.ts +2 -0
- package/dist/sdk/rest.d.ts.map +1 -0
- package/dist/sdk/rest.js +2 -0
- package/dist/sdk/rest.js.map +1 -0
- package/dist/sdk/sharding.d.ts +2 -0
- package/dist/sdk/sharding.d.ts.map +1 -0
- package/dist/sdk/sharding.js +2 -0
- package/dist/sdk/sharding.js.map +1 -0
- package/dist/sdk/types/routes.d.ts +2 -0
- package/dist/sdk/types/routes.d.ts.map +1 -0
- package/dist/sdk/types/routes.js +2 -0
- package/dist/sdk/types/routes.js.map +1 -0
- package/dist/sdk/types.d.ts +2 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +2 -0
- package/dist/sdk/types.js.map +1 -0
- package/dist/sdk/util.d.ts +2 -0
- package/dist/sdk/util.d.ts.map +1 -0
- package/dist/sdk/util.js +2 -0
- package/dist/sdk/util.js.map +1 -0
- package/dist/sdk/voice.d.ts +2 -0
- package/dist/sdk/voice.d.ts.map +1 -0
- package/dist/sdk/voice.js +2 -0
- package/dist/sdk/voice.js.map +1 -0
- package/dist/sdk/ws.d.ts +2 -0
- package/dist/sdk/ws.d.ts.map +1 -0
- package/dist/sdk/ws.js +2 -0
- package/dist/sdk/ws.js.map +1 -0
- package/dist/services/canvas-image.d.ts +12 -0
- package/dist/services/canvas-image.d.ts.map +1 -0
- package/dist/services/canvas-image.js +56 -0
- package/dist/services/canvas-image.js.map +1 -0
- package/dist/services/canvas.d.ts +12 -2
- package/dist/services/canvas.d.ts.map +1 -1
- package/dist/services/canvas.js +91 -5
- package/dist/services/canvas.js.map +1 -1
- package/dist/services/moderation.d.ts +1 -0
- package/dist/services/moderation.d.ts.map +1 -1
- package/dist/services/moderation.js +11 -0
- package/dist/services/moderation.js.map +1 -1
- package/dist/services/native-moderation.d.ts +6 -1
- package/dist/services/native-moderation.d.ts.map +1 -1
- package/dist/services/native-moderation.js +11 -1
- package/dist/services/native-moderation.js.map +1 -1
- package/dist/services/resource-authorization.d.ts.map +1 -1
- package/dist/services/resource-authorization.js +95 -3
- package/dist/services/resource-authorization.js.map +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +4 -0
- package/dist/testing.js.map +1 -1
- package/docs/API.md +8 -7
- package/docs/ARCHITECTURE.md +14 -9
- package/docs/BENCHMARKS.md +1 -1
- package/docs/CANVAS.md +70 -15
- package/docs/EDITOR.md +1 -1
- package/docs/FRAMEWORK.md +2 -3
- package/docs/HTTP.md +1 -1
- package/docs/IMAGES.md +2 -1
- package/docs/NATIVE.md +45 -14
- package/docs/PARITY-MATRIX.md +853 -843
- package/docs/PARITY.md +24 -12
- package/docs/PLAN.md +14 -3
- package/docs/QUICKSTART.md +5 -5
- package/docs/README.md +7 -7
- package/docs/REPOSITORY.md +1 -1
- package/docs/SCHEDULER.md +1 -1
- package/docs/TROUBLESHOOTING.md +1 -1
- package/docs/VALIDATION.md +5 -5
- package/docs/{FUNCTION-GAPS.md → functions/FUNCTION-GAPS.md} +18 -13
- package/docs/{LANGUAGE.md → functions/LANGUAGE.md} +7 -7
- package/docs/functions/README.md +33 -0
- package/docs/tutorials/DATA.md +2 -2
- package/docs/tutorials/FUNCTION-MODE.md +2 -2
- package/examples/canvas/napi-style.ts +24 -0
- package/examples/canvas/output/napi-style.png +0 -0
- package/examples/canvas/profile.d.mts +1 -1
- package/examples/canvas/profile.mjs +2 -2
- package/examples/canvas/profile.ts +3 -3
- package/examples/canvas/ranking.d.mts +1 -1
- package/examples/canvas/ranking.mjs +2 -2
- package/examples/canvas/ranking.ts +3 -3
- package/examples/canvas/render.ts +2 -1
- package/examples/canvas/welcome.d.mts +1 -1
- package/examples/canvas/welcome.mjs +2 -2
- package/examples/canvas/welcome.ts +3 -3
- package/examples/embeds/complete-embed-functions.ts +2 -2
- package/examples/function-mode.ts +3 -3
- package/examples/yuzuha.config.js +2 -0
- package/package.json +26 -1
- package/src/canvas/card.ts +20 -0
- package/src/canvas.ts +69 -17
- package/src/cli/config.ts +2 -1
- package/src/cli/lint.ts +1 -2
- package/src/cli/main.ts +8 -9
- package/src/cli/scaffold.ts +1 -1
- package/src/cli/scenarios.ts +2 -1
- package/src/commands/context.ts +9 -2
- package/src/domain/resource-batches.ts +31 -0
- package/src/framework/bot.ts +44 -27
- package/src/framework/command-registry.ts +15 -10
- package/src/framework/options.ts +3 -3
- package/src/{scripting → functions}/builtins/canvas.ts +2 -2
- package/src/{scripting → functions}/builtins/context.ts +1 -1
- package/src/{scripting → functions}/builtins/definition.ts +1 -1
- package/src/{scripting → functions}/builtins/embeds.ts +1 -1
- package/src/{scripting → functions}/builtins/flow.ts +2 -2
- package/src/{scripting → functions}/builtins/guards.ts +1 -1
- package/src/{scripting → functions}/builtins/http.ts +2 -2
- package/src/{scripting → functions}/builtins/index.ts +2 -2
- package/src/{scripting → functions}/builtins/language/array-callbacks.ts +2 -2
- package/src/{scripting → functions}/builtins/language/arrays.ts +1 -1
- package/src/{scripting → functions}/builtins/language/index.ts +1 -1
- package/src/{scripting → functions}/builtins/language/loops.ts +4 -4
- package/src/{scripting → functions}/builtins/language/regex.ts +1 -1
- package/src/{scripting → functions}/builtins/moderation.ts +1 -1
- package/src/{scripting → functions}/builtins/native-channels.ts +1 -1
- package/src/{scripting → functions}/builtins/native-roles.ts +1 -1
- package/src/{scripting → functions}/builtins/native-users.ts +1 -1
- package/src/{scripting → functions}/builtins/payload.ts +2 -2
- package/src/{scripting → functions}/builtins/resource-extras.ts +1 -1
- package/src/{scripting → functions}/builtins/values.ts +1 -1
- package/src/{scripting → functions/runtime}/canvas-execution.ts +1 -1
- package/src/{scripting → functions/runtime}/evaluator.ts +2 -2
- package/src/{scripting → functions/runtime}/limits.ts +1 -1
- package/src/{scripting → functions/runtime}/parser.ts +1 -1
- package/src/{scripting → functions/runtime}/regex.ts +1 -1
- package/src/{scripting → functions/runtime}/registry.ts +1 -1
- package/src/{scripting → functions/runtime}/runtime.ts +6 -1
- package/src/{scripting → functions/runtime}/types.ts +1 -1
- package/src/functions.ts +28 -8
- package/src/index.ts +9 -2
- package/src/infrastructure/canvas/napi.ts +17 -0
- package/src/infrastructure/fluxer/resources/cache.ts +69 -0
- package/src/infrastructure/fluxer/resources/channels.ts +51 -3
- package/src/infrastructure/fluxer/resources/collectors.ts +87 -4
- package/src/infrastructure/fluxer/resources/expressions.ts +7 -1
- package/src/infrastructure/fluxer/resources/gateway.ts +33 -0
- package/src/infrastructure/fluxer/resources/instance.ts +105 -0
- package/src/infrastructure/fluxer/resources/messages.ts +84 -36
- package/src/infrastructure/fluxer/resources/roles.ts +8 -0
- package/src/infrastructure/fluxer/resources/self.ts +39 -0
- package/src/infrastructure/fluxer/resources/threads.ts +14 -0
- package/src/infrastructure/fluxer/resources/users.ts +40 -4
- package/src/infrastructure/fluxer/resources/webhooks.ts +9 -0
- package/src/infrastructure/fluxer/resources.ts +12 -0
- package/src/ports/resources/cache.ts +81 -0
- package/src/ports/resources/channels.ts +12 -0
- package/src/ports/resources/collectors.ts +20 -0
- package/src/ports/resources/common.ts +2 -0
- package/src/ports/resources/expressions.ts +6 -0
- package/src/ports/resources/gateway.ts +49 -0
- package/src/ports/resources/instance.ts +109 -0
- package/src/ports/resources/messages.ts +30 -0
- package/src/ports/resources/roles.ts +3 -0
- package/src/ports/resources/self.ts +30 -0
- package/src/ports/resources/threads.ts +15 -0
- package/src/ports/resources/users.ts +33 -0
- package/src/ports/resources/webhooks.ts +6 -0
- package/src/ports/resources.ts +8 -0
- package/src/ports/script-engine.ts +42 -0
- package/src/sdk/builders.ts +1 -0
- package/src/sdk/client.ts +1 -0
- package/src/sdk/cluster.ts +1 -0
- package/src/sdk/collection.ts +1 -0
- package/src/sdk/errors.ts +1 -0
- package/src/sdk/internal.ts +1 -0
- package/src/sdk/message.ts +1 -0
- package/src/sdk/rest/request-manager.ts +1 -0
- package/src/sdk/rest.ts +1 -0
- package/src/sdk/sharding.ts +1 -0
- package/src/sdk/types/routes.ts +1 -0
- package/src/sdk/types.ts +1 -0
- package/src/sdk/util.ts +1 -0
- package/src/sdk/voice.ts +1 -0
- package/src/sdk/ws.ts +1 -0
- package/src/services/canvas-image.ts +54 -0
- package/src/services/canvas.ts +89 -6
- package/src/services/moderation.ts +4 -0
- package/src/services/native-moderation.ts +11 -1
- package/src/services/resource-authorization.ts +89 -3
- package/src/testing.ts +4 -0
- package/dist/parser.d.ts +0 -3
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -2
- package/dist/parser.js.map +0 -1
- package/dist/runtime.d.ts +0 -5
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -4
- package/dist/runtime.js.map +0 -1
- package/dist/scripting/ast.d.ts.map +0 -1
- package/dist/scripting/ast.js.map +0 -1
- package/dist/scripting/builtins/canvas.d.ts +0 -2
- package/dist/scripting/builtins/canvas.d.ts.map +0 -1
- package/dist/scripting/builtins/context.d.ts +0 -2
- package/dist/scripting/builtins/context.d.ts.map +0 -1
- package/dist/scripting/builtins/definition.d.ts.map +0 -1
- package/dist/scripting/builtins/definition.js.map +0 -1
- package/dist/scripting/builtins/embeds.d.ts +0 -3
- package/dist/scripting/builtins/embeds.js.map +0 -1
- package/dist/scripting/builtins/events.d.ts +0 -2
- package/dist/scripting/builtins/events.d.ts.map +0 -1
- package/dist/scripting/builtins/flow.d.ts +0 -2
- package/dist/scripting/builtins/flow.d.ts.map +0 -1
- package/dist/scripting/builtins/flow.js.map +0 -1
- package/dist/scripting/builtins/guards.d.ts +0 -2
- package/dist/scripting/builtins/guards.d.ts.map +0 -1
- package/dist/scripting/builtins/guards.js.map +0 -1
- package/dist/scripting/builtins/http.d.ts +0 -2
- package/dist/scripting/builtins/http.d.ts.map +0 -1
- package/dist/scripting/builtins/http.js.map +0 -1
- package/dist/scripting/builtins/index.d.ts +0 -5
- package/dist/scripting/builtins/index.d.ts.map +0 -1
- package/dist/scripting/builtins/index.js.map +0 -1
- package/dist/scripting/builtins/language/array-callbacks.d.ts +0 -2
- package/dist/scripting/builtins/language/array-callbacks.d.ts.map +0 -1
- package/dist/scripting/builtins/language/arrays.d.ts +0 -2
- package/dist/scripting/builtins/language/arrays.d.ts.map +0 -1
- package/dist/scripting/builtins/language/decimals.d.ts +0 -2
- package/dist/scripting/builtins/language/decimals.d.ts.map +0 -1
- package/dist/scripting/builtins/language/index.d.ts +0 -3
- package/dist/scripting/builtins/language/index.d.ts.map +0 -1
- package/dist/scripting/builtins/language/index.js.map +0 -1
- package/dist/scripting/builtins/language/loops.d.ts +0 -4
- package/dist/scripting/builtins/language/numbers.d.ts +0 -2
- package/dist/scripting/builtins/language/numbers.d.ts.map +0 -1
- package/dist/scripting/builtins/language/regex.d.ts +0 -2
- package/dist/scripting/builtins/language/regex.d.ts.map +0 -1
- package/dist/scripting/builtins/language/sort.d.ts +0 -2
- package/dist/scripting/builtins/language/sort.d.ts.map +0 -1
- package/dist/scripting/builtins/language/texts.d.ts +0 -2
- package/dist/scripting/builtins/language/texts.d.ts.map +0 -1
- package/dist/scripting/builtins/messages.d.ts +0 -2
- package/dist/scripting/builtins/messages.d.ts.map +0 -1
- package/dist/scripting/builtins/moderation.d.ts +0 -2
- package/dist/scripting/builtins/moderation.d.ts.map +0 -1
- package/dist/scripting/builtins/native-channels.d.ts +0 -2
- package/dist/scripting/builtins/native-channels.d.ts.map +0 -1
- package/dist/scripting/builtins/native-collectors.d.ts +0 -2
- package/dist/scripting/builtins/native-collectors.d.ts.map +0 -1
- package/dist/scripting/builtins/native-expressions.d.ts +0 -2
- package/dist/scripting/builtins/native-expressions.d.ts.map +0 -1
- package/dist/scripting/builtins/native-invites.d.ts +0 -2
- package/dist/scripting/builtins/native-invites.d.ts.map +0 -1
- package/dist/scripting/builtins/native-messages.d.ts +0 -2
- package/dist/scripting/builtins/native-messages.d.ts.map +0 -1
- package/dist/scripting/builtins/native-roles.d.ts +0 -2
- package/dist/scripting/builtins/native-roles.d.ts.map +0 -1
- package/dist/scripting/builtins/native-threads.d.ts +0 -2
- package/dist/scripting/builtins/native-threads.d.ts.map +0 -1
- package/dist/scripting/builtins/native-users.d.ts +0 -2
- package/dist/scripting/builtins/native-users.d.ts.map +0 -1
- package/dist/scripting/builtins/native-webhooks.d.ts +0 -2
- package/dist/scripting/builtins/native-webhooks.d.ts.map +0 -1
- package/dist/scripting/builtins/payload.d.ts.map +0 -1
- package/dist/scripting/builtins/payload.js.map +0 -1
- package/dist/scripting/builtins/resource-extras.d.ts +0 -2
- package/dist/scripting/builtins/resource-extras.d.ts.map +0 -1
- package/dist/scripting/builtins/schedule.d.ts +0 -2
- package/dist/scripting/builtins/schedule.d.ts.map +0 -1
- package/dist/scripting/builtins/storage.d.ts +0 -2
- package/dist/scripting/builtins/storage.d.ts.map +0 -1
- package/dist/scripting/builtins/values.d.ts +0 -2
- package/dist/scripting/builtins/values.d.ts.map +0 -1
- package/dist/scripting/builtins/values.js.map +0 -1
- package/dist/scripting/canvas-execution.d.ts.map +0 -1
- package/dist/scripting/canvas-execution.js.map +0 -1
- package/dist/scripting/control-flow.d.ts.map +0 -1
- package/dist/scripting/control-flow.js.map +0 -1
- package/dist/scripting/evaluator.d.ts.map +0 -1
- package/dist/scripting/evaluator.js.map +0 -1
- package/dist/scripting/limits.d.ts.map +0 -1
- package/dist/scripting/limits.js.map +0 -1
- package/dist/scripting/parser.d.ts.map +0 -1
- package/dist/scripting/parser.js.map +0 -1
- package/dist/scripting/regex.d.ts.map +0 -1
- package/dist/scripting/regex.js.map +0 -1
- package/dist/scripting/registry.d.ts.map +0 -1
- package/dist/scripting/registry.js.map +0 -1
- package/dist/scripting/runtime.d.ts.map +0 -1
- package/dist/scripting/runtime.js.map +0 -1
- package/dist/scripting/types.d.ts.map +0 -1
- package/dist/scripting/types.js.map +0 -1
- package/dist/scripting/values.d.ts.map +0 -1
- package/dist/scripting/values.js.map +0 -1
- package/src/parser.ts +0 -2
- package/src/runtime.ts +0 -4
- /package/dist/{scripting → functions}/builtins/arguments.d.ts +0 -0
- /package/dist/{scripting → functions}/builtins/arguments.js +0 -0
- /package/dist/{scripting → functions}/builtins/context.js +0 -0
- /package/dist/{scripting → functions}/builtins/definition.js +0 -0
- /package/dist/{scripting → functions}/builtins/events.js +0 -0
- /package/dist/{scripting → functions}/builtins/index.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/common.d.ts +0 -0
- /package/dist/{scripting → functions}/builtins/language/common.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/decimals.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/index.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/numbers.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/objects.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/sort.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/state.js +0 -0
- /package/dist/{scripting → functions}/builtins/language/texts.js +0 -0
- /package/dist/{scripting → functions}/builtins/messages.js +0 -0
- /package/dist/{scripting → functions}/builtins/moderation.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-channels.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-collectors.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-expressions.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-invites.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-messages.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-roles.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-threads.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-users.js +0 -0
- /package/dist/{scripting → functions}/builtins/native-webhooks.js +0 -0
- /package/dist/{scripting → functions}/builtins/resource-extras.js +0 -0
- /package/dist/{scripting → functions}/builtins/schedule.js +0 -0
- /package/dist/{scripting → functions}/builtins/storage.js +0 -0
- /package/dist/{scripting → functions/runtime}/ast.d.ts +0 -0
- /package/dist/{scripting → functions/runtime}/ast.js +0 -0
- /package/dist/{scripting → functions/runtime}/canvas-execution.js +0 -0
- /package/dist/{scripting → functions/runtime}/control-flow.d.ts +0 -0
- /package/dist/{scripting → functions/runtime}/control-flow.js +0 -0
- /package/dist/{scripting → functions/runtime}/limits.d.ts +0 -0
- /package/dist/{scripting → functions/runtime}/parser.d.ts +0 -0
- /package/dist/{scripting → functions/runtime}/regex-worker.mjs +0 -0
- /package/dist/{scripting → functions/runtime}/regex.d.ts +0 -0
- /package/dist/{scripting → functions/runtime}/registry.d.ts +0 -0
- /package/dist/{scripting → functions/runtime}/types.js +0 -0
- /package/dist/{scripting → functions/runtime}/values.d.ts +0 -0
- /package/dist/{scripting → functions/runtime}/values.js +0 -0
- /package/docs/{FUNCTIONS.md → functions/FUNCTIONS.md} +0 -0
- /package/docs/{LANGUAGE-EXTENSIONS.md → functions/LANGUAGE-EXTENSIONS.md} +0 -0
- /package/src/{scripting → functions}/builtins/arguments.ts +0 -0
- /package/src/{scripting → functions}/builtins/events.ts +0 -0
- /package/src/{scripting → functions}/builtins/language/common.ts +0 -0
- /package/src/{scripting → functions}/builtins/language/decimals.ts +0 -0
- /package/src/{scripting → functions}/builtins/language/numbers.ts +0 -0
- /package/src/{scripting → functions}/builtins/language/objects.ts +0 -0
- /package/src/{scripting → functions}/builtins/language/sort.ts +0 -0
- /package/src/{scripting → functions}/builtins/language/state.ts +0 -0
- /package/src/{scripting → functions}/builtins/language/texts.ts +0 -0
- /package/src/{scripting → functions}/builtins/messages.ts +0 -0
- /package/src/{scripting → functions}/builtins/native-collectors.ts +0 -0
- /package/src/{scripting → functions}/builtins/native-expressions.ts +0 -0
- /package/src/{scripting → functions}/builtins/native-invites.ts +0 -0
- /package/src/{scripting → functions}/builtins/native-messages.ts +0 -0
- /package/src/{scripting → functions}/builtins/native-threads.ts +0 -0
- /package/src/{scripting → functions}/builtins/native-webhooks.ts +0 -0
- /package/src/{scripting → functions}/builtins/schedule.ts +0 -0
- /package/src/{scripting → functions}/builtins/storage.ts +0 -0
- /package/src/{scripting → functions/runtime}/ast.ts +0 -0
- /package/src/{scripting → functions/runtime}/control-flow.ts +0 -0
- /package/src/{scripting → functions/runtime}/regex-worker.mjs +0 -0
- /package/src/{scripting → functions/runtime}/values.ts +0 -0
|
@@ -3,8 +3,8 @@ import type { CanvasAvatarOptions, CanvasBadgeItem, CanvasBadgesOptions, CanvasC
|
|
|
3
3
|
CanvasImageOptions, CanvasLineOptions, CanvasProgressOptions, CanvasRectOptions, CanvasTextOptions } from '../../domain/canvas.js';
|
|
4
4
|
import type { CanvasBuilder, CanvasSendOptions } from '../../services/canvas.js';
|
|
5
5
|
import { YuzuhaError } from '../../shared/errors.js';
|
|
6
|
-
import { canvasExecution } from '../canvas-execution.js';
|
|
7
|
-
import type { FunctionCall } from '../types.js';
|
|
6
|
+
import { canvasExecution } from '../runtime/canvas-execution.js';
|
|
7
|
+
import type { FunctionCall } from '../runtime/types.js';
|
|
8
8
|
import { defineFunctions } from './definition.js';
|
|
9
9
|
|
|
10
10
|
function requiredId(value: string): string {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Embed, EmbedField } from '../../domain/messages.js';
|
|
2
2
|
import { YuzuhaError } from '../../errors.js';
|
|
3
3
|
import { httpURL, isoTimestamp, mergeEmbedParts, normalizeEmbed, normalizeFields, parseColor, validateEmbed } from '../../domain/embeds.js';
|
|
4
|
-
import { truthy } from '../values.js';
|
|
4
|
+
import { truthy } from '../runtime/values.js';
|
|
5
5
|
import { defineFunctions } from './definition.js';
|
|
6
6
|
|
|
7
7
|
export { validateEmbed } from '../../domain/embeds.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GuardError, PartialModerationError, ScriptError, StopExecution, YuzuhaError } from '../../errors.js';
|
|
2
|
-
import { truthy } from '../values.js';
|
|
2
|
+
import { truthy } from '../runtime/values.js';
|
|
3
3
|
import { defineFunctions } from './definition.js';
|
|
4
|
-
import { LoopControl } from '../control-flow.js';
|
|
4
|
+
import { LoopControl } from '../runtime/control-flow.js';
|
|
5
5
|
|
|
6
6
|
export const flowFunctions = defineFunctions(fn => {
|
|
7
7
|
fn('let', 'flow', 2, 2, '[nome;valor]', 'Define variável local sem produzir texto.', async c => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { text } from '../values.js';
|
|
2
|
-
import { loopFrame, setLoopFrame, LoopControl } from '../control-flow.js';
|
|
1
|
+
import { text } from '../runtime/values.js';
|
|
2
|
+
import { loopFrame, setLoopFrame, LoopControl } from '../runtime/control-flow.js';
|
|
3
3
|
import { YuzuhaError } from '../../errors.js';
|
|
4
4
|
import { defineFunctions } from './definition.js';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Runtime } from '../runtime.js';
|
|
2
|
-
import type { FunctionDefinition } from '../types.js';
|
|
1
|
+
import type { Runtime } from '../runtime/runtime.js';
|
|
2
|
+
import type { FunctionDefinition } from '../runtime/types.js';
|
|
3
3
|
import { channelFunctions } from './native-channels.js';
|
|
4
4
|
import { collectorFunctions } from './native-collectors.js';
|
|
5
5
|
import { expressionFunctions } from './native-expressions.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { YuzuhaError } from '../../../errors.js';
|
|
2
|
-
import type { FunctionCall } from '../../types.js';
|
|
3
|
-
import { text, truthy } from '../../values.js';
|
|
2
|
+
import type { FunctionCall } from '../../runtime/types.js';
|
|
3
|
+
import { text, truthy } from '../../runtime/values.js';
|
|
4
4
|
import { defineFunctions } from '../definition.js';
|
|
5
5
|
import { requireArray } from './common.js';
|
|
6
6
|
import { withLoopState } from './loops.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { YuzuhaError } from '../../../errors.js';
|
|
2
2
|
import { toJson } from '../arguments.js';
|
|
3
|
-
import { text } from '../../values.js';
|
|
3
|
+
import { text } from '../../runtime/values.js';
|
|
4
4
|
import { defineFunctions } from '../definition.js';
|
|
5
5
|
import { deepEqual, integer, jsonClone, requireArray, typedScalar } from './common.js';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FunctionDefinition } from '../../types.js';
|
|
1
|
+
import type { FunctionDefinition } from '../../runtime/types.js';
|
|
2
2
|
import { arrayFunctions } from './arrays.js';
|
|
3
3
|
import { arrayCallbackFunctions } from './array-callbacks.js';
|
|
4
4
|
import { loopFunctions } from './loops.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { YuzuhaError } from '../../../errors.js';
|
|
2
|
-
import { text } from '../../values.js';
|
|
3
|
-
import { truthy } from '../../values.js';
|
|
4
|
-
import { loopFrame, setLoopFrame, LoopControl } from '../../control-flow.js';
|
|
2
|
+
import { text } from '../../runtime/values.js';
|
|
3
|
+
import { truthy } from '../../runtime/values.js';
|
|
4
|
+
import { loopFrame, setLoopFrame, LoopControl } from '../../runtime/control-flow.js';
|
|
5
5
|
import { defineFunctions } from '../definition.js';
|
|
6
|
-
import type { FunctionCall } from '../../types.js';
|
|
6
|
+
import type { FunctionCall } from '../../runtime/types.js';
|
|
7
7
|
import { integer, requireArray } from './common.js';
|
|
8
8
|
import { LOOP_ACCUMULATOR_KEY, LOOP_INDEX_KEY, LOOP_MAX, LOOP_VALUE_KEY } from './state.js';
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseDuration } from '../../domain/values.js';
|
|
2
|
-
import type { FunctionCall } from '../types.js';
|
|
2
|
+
import type { FunctionCall } from '../runtime/types.js';
|
|
3
3
|
import { finite } from './arguments.js';
|
|
4
4
|
import { defineFunctions } from './definition.js';
|
|
5
5
|
import { YuzuhaError } from '../../shared/errors.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { YuzuhaError } from '../../errors.js';
|
|
2
2
|
import { defineFunctions } from './definition.js';
|
|
3
3
|
import { integer } from './language/common.js';
|
|
4
|
-
import type { FunctionCall } from '../types.js';
|
|
4
|
+
import type { FunctionCall } from '../runtime/types.js';
|
|
5
5
|
import { GuardError } from '../../shared/errors.js';
|
|
6
6
|
|
|
7
7
|
const channelTypes: Record<string, number> = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { YuzuhaError } from '../../errors.js';
|
|
2
2
|
import type { RoleInfo } from '../../ports/resources/roles.js';
|
|
3
|
-
import type { FunctionCall } from '../types.js';
|
|
3
|
+
import type { FunctionCall } from '../runtime/types.js';
|
|
4
4
|
import { defineFunctions } from './definition.js';
|
|
5
5
|
import { integer } from './language/common.js';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActivityType, PresenceStatus } from '../../ports/resources/common.js';
|
|
2
|
-
import type { FunctionCall } from '../types.js';
|
|
2
|
+
import type { FunctionCall } from '../runtime/types.js';
|
|
3
3
|
import { GuardError, YuzuhaError } from '../../errors.js';
|
|
4
4
|
import { defineFunctions } from './definition.js';
|
|
5
5
|
import { userID } from '../../domain/values.js';
|
|
@@ -2,8 +2,8 @@ import type { AllowedMentionsPolicy, Embed, MentionParse, Payload } from '../../
|
|
|
2
2
|
import { assertEmbedCount, normalizeEmbed } from '../../domain/embeds.js';
|
|
3
3
|
import { YuzuhaError } from '../../errors.js';
|
|
4
4
|
import { AuthorizationService } from '../../services/authorization.js';
|
|
5
|
-
import type { FunctionCall } from '../types.js';
|
|
6
|
-
import { text } from '../values.js';
|
|
5
|
+
import type { FunctionCall } from '../runtime/types.js';
|
|
6
|
+
import { text } from '../runtime/values.js';
|
|
7
7
|
import { defineFunctions } from './definition.js';
|
|
8
8
|
|
|
9
9
|
const MESSAGE_KEYS = new Set(['content', 'embeds', 'tts', 'stickerIds', 'flags', 'allowedMentions']);
|
|
@@ -3,7 +3,7 @@ import { YuzuhaError } from '../../errors.js';
|
|
|
3
3
|
import type { AttachmentSpec, BinaryAttachmentSpec } from '../../ports/resources/common.js';
|
|
4
4
|
import type { GuildEditInput } from '../../ports/resources/users.js';
|
|
5
5
|
import type { ThreadEditInput } from '../../ports/resources/threads.js';
|
|
6
|
-
import type { FunctionCall } from '../types.js';
|
|
6
|
+
import type { FunctionCall } from '../runtime/types.js';
|
|
7
7
|
import { defineFunctions } from './definition.js';
|
|
8
8
|
import { messageSearchInput } from '../../domain/message-query.js';
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomInt } from 'node:crypto';
|
|
2
2
|
import { YuzuhaError } from '../../errors.js';
|
|
3
|
-
import { truthy } from '../values.js';
|
|
3
|
+
import { truthy } from '../runtime/values.js';
|
|
4
4
|
import { finite } from './arguments.js';
|
|
5
5
|
import { defineFunctions } from './definition.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
|
-
import type { CommandContext } from '
|
|
3
|
-
import { GuardError, PartialModerationError, ScriptError, StopExecution, YuzuhaError } from '
|
|
2
|
+
import type { CommandContext } from '../../commands/context.js';
|
|
3
|
+
import { GuardError, PartialModerationError, ScriptError, StopExecution, YuzuhaError } from '../../errors.js';
|
|
4
4
|
import type { CallNode, Node, Program } from './ast.js';
|
|
5
5
|
import type { FunctionRegistry } from './registry.js';
|
|
6
6
|
import type { FunctionCall, Limits } from './types.js';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { CommandContext } from '
|
|
1
|
+
import type { CommandContext } from '../../commands/context.js';
|
|
2
2
|
import type { Program } from './ast.js';
|
|
3
3
|
import { Evaluator } from './evaluator.js';
|
|
4
4
|
import { defaultLimits, resolveLimits } from './limits.js';
|
|
5
5
|
import { parse } from './parser.js';
|
|
6
6
|
import { FunctionRegistry } from './registry.js';
|
|
7
7
|
import type { FunctionDefinition, Limits } from './types.js';
|
|
8
|
+
import { text } from './values.js';
|
|
8
9
|
|
|
9
10
|
export class Runtime {
|
|
10
11
|
private readonly registry = new FunctionRegistry();
|
|
@@ -26,6 +27,10 @@ export class Runtime {
|
|
|
26
27
|
|
|
27
28
|
functions(): FunctionDefinition[] { return this.registry.functions(); }
|
|
28
29
|
|
|
30
|
+
fork(): Runtime { return new Runtime(this.limits).registerAll(this.functions()); }
|
|
31
|
+
|
|
32
|
+
text(value: unknown): string { return text(value); }
|
|
33
|
+
|
|
29
34
|
compile(source: string, file?: string): Program {
|
|
30
35
|
const program = parse(source, file);
|
|
31
36
|
this.registry.validate(program);
|
package/src/functions.ts
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
import type { Command } from './context.js';
|
|
2
|
+
import { Runtime } from './functions/runtime/runtime.js';
|
|
3
|
+
import { defaultLimits } from './functions/runtime/limits.js';
|
|
4
|
+
import { registerBuiltins } from './functions/builtins/index.js';
|
|
5
|
+
import type { FunctionDefinition, Limits } from './functions/runtime/types.js';
|
|
6
|
+
import type { ScriptEngine } from './ports/script-engine.js';
|
|
2
7
|
|
|
3
|
-
export { Runtime
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
8
|
+
export { Runtime } from './functions/runtime/runtime.js';
|
|
9
|
+
export { defaultLimits } from './functions/runtime/limits.js';
|
|
10
|
+
export { text, truthy } from './functions/runtime/values.js';
|
|
11
|
+
export type { FunctionCall, FunctionDefinition, Limits } from './functions/runtime/types.js';
|
|
12
|
+
export { parse } from './functions/runtime/parser.js';
|
|
13
|
+
export type { Program, Node, CallNode, TextNode } from './functions/runtime/ast.js';
|
|
14
|
+
export { builtinFunctions, registerBuiltins } from './functions/builtins/index.js';
|
|
15
|
+
export { validateEmbed } from './functions/builtins/embeds.js';
|
|
16
|
+
export type { ScriptEngine, ScriptFunctionDefinition, ScriptLimits } from './ports/script-engine.js';
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
|
-
* Marca um comando escrito em function mode. O
|
|
12
|
-
*
|
|
19
|
+
* Marca um comando escrito em function mode. O bot precisa de um engine;
|
|
20
|
+
* veja `functions()`.
|
|
13
21
|
*/
|
|
14
22
|
export function script(command: Command): Command {
|
|
15
23
|
return command;
|
|
16
24
|
}
|
|
25
|
+
|
|
26
|
+
export interface FunctionsOptions {
|
|
27
|
+
limits?: Partial<Limits>;
|
|
28
|
+
functions?: FunctionDefinition[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Cria o motor de function mode com os builtins registrados. Use `engine: functions()` no bot. */
|
|
32
|
+
export function functions(options: FunctionsOptions = {}): ScriptEngine {
|
|
33
|
+
const runtime = new Runtime({ ...defaultLimits, ...options.limits });
|
|
34
|
+
if (options.functions?.length) runtime.registerAll(options.functions);
|
|
35
|
+
return registerBuiltins(runtime);
|
|
36
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type { EventContextOptions } from './commands/event-context.js';
|
|
|
17
17
|
export type { ScriptEventDefinition } from './framework/script-events.js';
|
|
18
18
|
export type { ScriptEventData, ScriptEventName } from './domain/events.js';
|
|
19
19
|
export type { NativeAccess } from './ports/native.js';
|
|
20
|
+
export type { ScriptEngine, ScriptFunctionDefinition, ScriptLimits } from './ports/script-engine.js';
|
|
20
21
|
export type { NativeVoice, FluxerVoiceConnection, FluxerVoiceDriver } from './ports/voice.js';
|
|
21
22
|
export type { Resources } from './ports/resources.js';
|
|
22
23
|
export type {
|
|
@@ -28,12 +29,18 @@ export type {
|
|
|
28
29
|
ChannelInfo, ChannelCreateInput, ChannelEditInput, ChannelOverwriteInput, ChannelsResources,
|
|
29
30
|
} from './ports/resources/channels.js';
|
|
30
31
|
export type { AttachmentInfo, MessageInfo, MessagesResources, MessageCursor, MessageSearchInput, MessageSearchPage,
|
|
31
|
-
PinnedMessagesInput, PinnedMessagesPage, ReactionUsersPage
|
|
32
|
-
|
|
32
|
+
PinnedMessagesInput, PinnedMessagesPage, ReactionUsersPage,
|
|
33
|
+
BulkFetchRequest, BulkFetchInput, BulkFetchRawChannel } from './ports/resources/messages.js';
|
|
34
|
+
export type { AwaitMessageInput, CollectedMessageInfo, CollectMessagesInput, CollectReactionsInput, CollectorsResources, ReactionVote } from './ports/resources/collectors.js';
|
|
33
35
|
export type { WebhookInfo, WebhookSendInput, WebhooksResources } from './ports/resources/webhooks.js';
|
|
34
36
|
export type { EmojiInfo, EmojiCreateInput, EmojiBulkResult, StickerInfo, StickerCreateInput, StickerEditInput, ExpressionsResources } from './ports/resources/expressions.js';
|
|
35
37
|
export type { ThreadInfo, ThreadMemberInfo, ThreadMemberDetails, ThreadCreateInput, ForumPostInput, ThreadsResources, ThreadEditInput, ThreadSearchInput, ThreadSearchPage, ArchivedThreadsInput, ThreadListPage } from './ports/resources/threads.js';
|
|
36
38
|
export type { InviteInfo, InviteCreateInput, InvitesResources } from './ports/resources/invites.js';
|
|
39
|
+
export type { GatewayMembersRequest, ChannelCountsRequest, ForumUnreadsRequest, ThreadSubscriptionInput, GatewayResources } from './ports/resources/gateway.js';
|
|
40
|
+
export type { InstanceEndpointsInfo, InstanceFeaturesInfo, InstanceServicesInfo, InstanceInfo, GatewayInfo, ApplicationInfo,
|
|
41
|
+
EmojiMetadataInfo, StickerMetadataInfo, EmojiReference, InstanceResources } from './ports/resources/instance.js';
|
|
42
|
+
export type { SudoVerification, SelfGuildInfo, SelfResources } from './ports/resources/self.js';
|
|
43
|
+
export type { CacheLimitsInfo, CacheStatsInfo, MessageSweepInput, MemberSweepInput, CacheResources } from './ports/resources/cache.js';
|
|
37
44
|
export type { AttachmentSpec, BinaryAttachmentSpec, PresenceStatus, ActivityType, ActivityInfo } from './ports/resources/common.js';
|
|
38
45
|
export { NativeModeration } from './services/native-moderation.js';
|
|
39
46
|
export type { NativeModerationOptions, NativeBanOptions, NativeTimeoutOptions, NativeMoveOptions, NativeVoiceOptions, ModerationTarget } from './services/native-moderation.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { YuzuhaError } from '../../shared/errors.js';
|
|
2
|
+
|
|
3
|
+
export function canvasDependency(): YuzuhaError {
|
|
4
|
+
return new YuzuhaError('CANVAS_DEPENDENCY', 'Instale @napi-rs/canvas@^1.0.13 para renderizar imagens com yuzuha/canvas.');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let loaded: typeof import('@napi-rs/canvas') | undefined;
|
|
8
|
+
try {
|
|
9
|
+
const module = await import('@napi-rs/canvas') as unknown as Record<string, unknown>;
|
|
10
|
+
loaded = (module.createCanvas ? module : module.default) as typeof import('@napi-rs/canvas');
|
|
11
|
+
} catch (cause) {
|
|
12
|
+
const code = (cause as NodeJS.ErrnoException)?.code;
|
|
13
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
14
|
+
if (code !== 'ERR_MODULE_NOT_FOUND' || !message.includes('@napi-rs/canvas')) throw cause;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const napi = loaded;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Client, GuildChannel } from '@fluxerjs/core';
|
|
2
|
+
import { YuzuhaError } from '../../../errors.js';
|
|
3
|
+
import type { CacheResources } from '../../../ports/resources/cache.js';
|
|
4
|
+
import { toMessageInfo } from './messages.js';
|
|
5
|
+
import { toGuildInfo, toMemberInfo, toUserInfo } from './users.js';
|
|
6
|
+
import { toChannelInfo } from './channels.js';
|
|
7
|
+
|
|
8
|
+
function bounded(value: number): number | null {
|
|
9
|
+
return Number.isFinite(value) ? value : null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function createCacheResources(client: Client): CacheResources {
|
|
13
|
+
return {
|
|
14
|
+
async stats() {
|
|
15
|
+
const sizes = client.cache.stats();
|
|
16
|
+
const messages = client._messageCacheStats();
|
|
17
|
+
const limits = client.cache.limits;
|
|
18
|
+
return {
|
|
19
|
+
...sizes,
|
|
20
|
+
messages: messages.messages,
|
|
21
|
+
messageChannels: messages.channels,
|
|
22
|
+
limits: {
|
|
23
|
+
guilds: bounded(limits.guilds),
|
|
24
|
+
channels: bounded(limits.channels),
|
|
25
|
+
users: bounded(limits.users),
|
|
26
|
+
members: bounded(limits.members),
|
|
27
|
+
messages: limits.messages === false ? false : bounded(limits.messages),
|
|
28
|
+
roles: bounded(limits.roles),
|
|
29
|
+
emojis: bounded(limits.emojis),
|
|
30
|
+
stickers: bounded(limits.stickers),
|
|
31
|
+
cascading: client.cache.cascading,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
async sweepMessages(input = {}) {
|
|
36
|
+
const { channelID, maxAgeMs, keep } = input;
|
|
37
|
+
if (maxAgeMs !== undefined && (!Number.isSafeInteger(maxAgeMs) || maxAgeMs < 0)) {
|
|
38
|
+
throw new YuzuhaError('SWEEP_AGE', 'maxAgeMs deve ser um inteiro não negativo.');
|
|
39
|
+
}
|
|
40
|
+
const cutoff = maxAgeMs === undefined ? null : Date.now() - maxAgeMs;
|
|
41
|
+
return client.sweepMessages((message, channelId) => {
|
|
42
|
+
if (cutoff !== null && message.createdAt.getTime() >= cutoff) return false;
|
|
43
|
+
return keep ? !keep(toMessageInfo(message), channelId) : true;
|
|
44
|
+
}, channelID);
|
|
45
|
+
},
|
|
46
|
+
async sweepMembers(input = {}) {
|
|
47
|
+
const { guildID, keep } = input;
|
|
48
|
+
return client.sweepMembers((member, guildId) => {
|
|
49
|
+
if (guildID !== undefined && guildId !== guildID) return false;
|
|
50
|
+
return keep ? !keep(toMemberInfo(member), guildId) : true;
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
async sweepUsers(input = {}) {
|
|
54
|
+
return client.cache.sweepUsers((user, id) => (input.keep ? !input.keep(toUserInfo(user), id) : true));
|
|
55
|
+
},
|
|
56
|
+
async sweepChannels(input = {}) {
|
|
57
|
+
return client.cache.sweepChannels((channel, id) => (input.keep ? !input.keep(toChannelInfo(channel as GuildChannel), id) : true));
|
|
58
|
+
},
|
|
59
|
+
async sweepGuilds(input = {}) {
|
|
60
|
+
return client.cache.sweepGuilds((guild, id) => (input.keep ? !input.keep(toGuildInfo(guild), id) : true));
|
|
61
|
+
},
|
|
62
|
+
async cascadeChannel(channelID): Promise<void> {
|
|
63
|
+
client.cache.cascadeChannel(await client.channels.fetch(channelID));
|
|
64
|
+
},
|
|
65
|
+
async cascadeGuild(guildID): Promise<void> {
|
|
66
|
+
client.cache.cascadeGuild(await client.guilds.resolve(guildID));
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OverwriteType } from '@fluxerjs/core';
|
|
2
|
-
import type { ChannelEditOptions, ChannelType, Client, GuildChannel, PermissionResolvable } from '@fluxerjs/core';
|
|
1
|
+
import { OverwriteType, ForumLayout } from '@fluxerjs/core';
|
|
2
|
+
import type { ChannelEditOptions, ChannelType, Client, DMChannel, GuildChannel, PermissionResolvable } from '@fluxerjs/core';
|
|
3
3
|
import type { ChannelCreateInput, ChannelEditInput, ChannelInfo, ChannelOverwriteInput, ChannelsResources } from '../../../ports/resources/channels.js';
|
|
4
4
|
import { YuzuhaError } from '../../../errors.js';
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ type ChannelExtras = {
|
|
|
12
12
|
contentWarningText?: string | null;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
function toChannelInfo(channel: GuildChannel): ChannelInfo {
|
|
15
|
+
export function toChannelInfo(channel: GuildChannel): ChannelInfo {
|
|
16
16
|
const extras = channel as GuildChannel & ChannelExtras;
|
|
17
17
|
return {
|
|
18
18
|
id: channel.id,
|
|
@@ -36,6 +36,12 @@ async function guildChannel(client: Client, channelID: string): Promise<GuildCha
|
|
|
36
36
|
return channel;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
async function dmChannel(client: Client, channelID: string): Promise<DMChannel> {
|
|
40
|
+
const channel = await client.channels.fetch(channelID);
|
|
41
|
+
if (!channel.isDM()) throw new YuzuhaError('CHANNEL_DM', 'Esta operação exige um canal de DM.');
|
|
42
|
+
return channel;
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
function validateExtras(input: ChannelEditInput): void {
|
|
40
46
|
if (input.url !== undefined && input.url !== null) {
|
|
41
47
|
let url: URL;
|
|
@@ -73,8 +79,22 @@ async function overwriteKind(client: Client, channel: GuildChannel, targetID: st
|
|
|
73
79
|
export function createChannelsResources(client: Client): ChannelsResources {
|
|
74
80
|
return {
|
|
75
81
|
async get(channelID): Promise<ChannelInfo> {
|
|
82
|
+
const channel = await client.channels.fetch(channelID);
|
|
83
|
+
if (channel.isDM()) {
|
|
84
|
+
return { id: channel.id, name: channel.name ?? '', type: Number(channel.type), guildID: null,
|
|
85
|
+
parentID: null, position: 0, topic: null, slowmode: 0, nsfw: false,
|
|
86
|
+
recipientIDs: channel.recipients.map(user => user.id), ownerID: channel.ownerId };
|
|
87
|
+
}
|
|
76
88
|
return toChannelInfo(await guildChannel(client, channelID));
|
|
77
89
|
},
|
|
90
|
+
async addRecipient(channelID, userID): Promise<void> {
|
|
91
|
+
const channel = await dmChannel(client, channelID);
|
|
92
|
+
await channel.addRecipient(userID);
|
|
93
|
+
},
|
|
94
|
+
async removeRecipient(channelID, userID, options): Promise<void> {
|
|
95
|
+
const channel = await dmChannel(client, channelID);
|
|
96
|
+
await channel.removeRecipient(userID, options?.silent === undefined ? undefined : { silent: options.silent });
|
|
97
|
+
},
|
|
78
98
|
async list(guildID, limit?): Promise<ChannelInfo[]> {
|
|
79
99
|
const guild = await client.guilds.resolve(guildID);
|
|
80
100
|
const channels = [...await guild.fetchChannels()]
|
|
@@ -124,6 +144,19 @@ export function createChannelsResources(client: Client): ChannelsResources {
|
|
|
124
144
|
if (reason === undefined) await channel.edit({ rateLimitPerUser: seconds });
|
|
125
145
|
else await channel.edit({ rateLimitPerUser: seconds, reason });
|
|
126
146
|
},
|
|
147
|
+
async slowmode(channelID): Promise<number> {
|
|
148
|
+
const channel = await guildChannel(client, channelID);
|
|
149
|
+
return (await channel.fetchSlowmode()).rateLimitPerUser ?? 0;
|
|
150
|
+
},
|
|
151
|
+
async sendTyping(channelID): Promise<void> {
|
|
152
|
+
const channel = await guildChannel(client, channelID);
|
|
153
|
+
if (!channel.isTextBased()) throw new YuzuhaError('CHANNEL_TEXT', 'Canal sem suporte a mensagens.');
|
|
154
|
+
await channel.sendTyping();
|
|
155
|
+
},
|
|
156
|
+
async rtcRegions(channelID) {
|
|
157
|
+
const channel = await guildChannel(client, channelID);
|
|
158
|
+
return (await channel.fetchRtcRegions()).map(region => ({ id: region.id, name: region.name, emoji: region.emoji }));
|
|
159
|
+
},
|
|
127
160
|
async overwrite(channelID, targetID, input: ChannelOverwriteInput): Promise<void> {
|
|
128
161
|
const channel = await guildChannel(client, channelID);
|
|
129
162
|
await channel.permissionOverwrites.edit(targetID, {
|
|
@@ -138,6 +171,21 @@ export function createChannelsResources(client: Client): ChannelsResources {
|
|
|
138
171
|
const member = await guild.fetchMember(userID);
|
|
139
172
|
return member.permissionsIn(channel).toJSON();
|
|
140
173
|
},
|
|
174
|
+
async editThreadDefaults(channelID, input): Promise<void> {
|
|
175
|
+
const channel = await guildChannel(client, channelID);
|
|
176
|
+
const edit = (channel as { editThreadDefaults?: unknown }).editThreadDefaults;
|
|
177
|
+
if (typeof edit !== 'function') throw new YuzuhaError('CHANNEL_THREAD', 'O canal não suporta padrões de thread.');
|
|
178
|
+
const { slowmode, autoArchiveDuration, reason } = input;
|
|
179
|
+
await (edit as (options: Record<string, unknown>) => Promise<unknown>).call(channel, {
|
|
180
|
+
autoArchiveDuration: autoArchiveDuration === null ? null : autoArchiveDuration,
|
|
181
|
+
rateLimitPerUser: slowmode, reason });
|
|
182
|
+
},
|
|
183
|
+
async setDefaultForumLayout(channelID, layout, reason): Promise<void> {
|
|
184
|
+
const channel = await guildChannel(client, channelID);
|
|
185
|
+
if (!channel.isForum()) throw new YuzuhaError('CHANNEL_FORUM', 'Layout padrão exige um canal de fórum.');
|
|
186
|
+
const value = layout === null ? null : { default: ForumLayout.Default, list: ForumLayout.List, grid: ForumLayout.Grid }[layout];
|
|
187
|
+
await channel.setDefaultForumLayout(value, reason);
|
|
188
|
+
},
|
|
141
189
|
async move(channelID, position): Promise<void> {
|
|
142
190
|
if (!Number.isSafeInteger(position) || position < 0) throw new YuzuhaError('POSITION', 'Posição deve ser um inteiro a partir de 0.');
|
|
143
191
|
const channel = await guildChannel(client, channelID);
|