@luckylillia-dev/luckylillia 0.0.0-stage → 9.0.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/chunks/preload-helper-D5R8FHQt.js +342 -0
- package/chunks/preload-helper-D5R8FHQt.js.map +1 -0
- package/default_config.json +83 -0
- package/llbot-core.js +35013 -0
- package/llbot-core.js.map +1 -0
- package/llbot.js +138 -0
- package/llbot.js.map +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/commands.d.ts +86 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/commands.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/config.d.ts +14 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/config.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/ffmpeg.d.ts +41 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/ffmpeg.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/http.d.ts +88 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/http.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/index.d.ts +17 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/index.js +6 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/internal.d.ts +430 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/internal.js +7 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/manifest.d.ts +68 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/manifest.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/server.d.ts +23 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/server.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/storage.d.ts +21 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/storage.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/testing.d.ts +71 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/testing.js +1123 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/universal.d.ts +299 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/universal.js +1 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/webui.d.ts +762 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/webui.js +9 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/package.json +63 -0
- package/node_modules/@satorijs/element/jsx-dev-runtime.d.ts +3 -0
- package/node_modules/@satorijs/element/jsx-runtime.d.ts +3 -0
- package/node_modules/@satorijs/element/lib/index.cjs +447 -0
- package/node_modules/@satorijs/element/lib/index.d.ts +116 -0
- package/node_modules/@satorijs/element/lib/index.mjs +455 -0
- package/node_modules/@satorijs/element/package.json +60 -0
- package/node_modules/@satorijs/element/src/index.ts +559 -0
- package/node_modules/@satorijs/protocol/lib/index.cjs +187 -0
- package/node_modules/@satorijs/protocol/lib/index.d.ts +328 -0
- package/node_modules/@satorijs/protocol/lib/index.mjs +148 -0
- package/node_modules/@satorijs/protocol/package.json +44 -0
- package/node_modules/@satorijs/protocol/src/index.ts +513 -0
- package/node_modules/@standard-schema/spec/LICENSE +21 -0
- package/node_modules/@standard-schema/spec/README.md +198 -0
- package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
- package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.js +0 -0
- package/node_modules/@standard-schema/spec/package.json +52 -0
- package/node_modules/cordis/README.md +10 -0
- package/node_modules/cordis/bin.js +16 -0
- package/node_modules/cordis/lib/context.d.ts +32 -0
- package/node_modules/cordis/lib/events.d.ts +62 -0
- package/node_modules/cordis/lib/fiber.d.ts +85 -0
- package/node_modules/cordis/lib/index.d.ts +7 -0
- package/node_modules/cordis/lib/index.js +1577 -0
- package/node_modules/cordis/lib/logger.d.ts +74 -0
- package/node_modules/cordis/lib/reflect.d.ts +54 -0
- package/node_modules/cordis/lib/registry.d.ts +78 -0
- package/node_modules/cordis/lib/service.d.ts +19 -0
- package/node_modules/cordis/lib/utils.d.ts +50 -0
- package/node_modules/cordis/package.json +49 -0
- package/node_modules/cosmokit/LICENSE +21 -0
- package/node_modules/cosmokit/README.md +24 -0
- package/node_modules/cosmokit/lib/index.cjs +419 -0
- package/node_modules/cosmokit/lib/index.cjs.map +6 -0
- package/node_modules/cosmokit/lib/index.d.ts +142 -0
- package/node_modules/cosmokit/lib/index.mjs +357 -0
- package/node_modules/cosmokit/lib/index.mjs.map +6 -0
- package/node_modules/cosmokit/package.json +57 -0
- package/node_modules/cosmokit/src/array.ts +35 -0
- package/node_modules/cosmokit/src/index.ts +5 -0
- package/node_modules/cosmokit/src/misc.ts +57 -0
- package/node_modules/cosmokit/src/string.ts +101 -0
- package/node_modules/cosmokit/src/time.ts +91 -0
- package/node_modules/cosmokit/src/types.ts +131 -0
- package/node_modules/schemastery/README.md +342 -0
- package/node_modules/schemastery/lib/index.cjs +648 -0
- package/node_modules/schemastery/lib/index.cjs.map +6 -0
- package/node_modules/schemastery/lib/index.d.ts +138 -0
- package/node_modules/schemastery/lib/index.mjs +656 -0
- package/node_modules/schemastery/lib/index.mjs.map +6 -0
- package/node_modules/schemastery/package.json +32 -0
- package/node_modules/schemastery/src/index.ts +841 -0
- package/node_modules/undici/LICENSE +21 -0
- package/node_modules/undici/README.md +741 -0
- package/node_modules/undici/docs/docs/api/Agent.md +84 -0
- package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
- package/node_modules/undici/docs/docs/api/Client.md +290 -0
- package/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/node_modules/undici/docs/docs/api/Cookies.md +128 -0
- package/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +317 -0
- package/node_modules/undici/docs/docs/api/Dispatcher.md +1393 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +60 -0
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
- package/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/node_modules/undici/docs/docs/api/MockClient.md +81 -0
- package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/node_modules/undici/docs/docs/api/MockPool.md +555 -0
- package/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
- package/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
- package/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
- package/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
- package/node_modules/undici/index-fetch.js +65 -0
- package/node_modules/undici/index.d.ts +3 -0
- package/node_modules/undici/index.js +234 -0
- package/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/node_modules/undici/lib/api/api-connect.js +110 -0
- package/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/node_modules/undici/lib/api/api-request.js +214 -0
- package/node_modules/undici/lib/api/api-stream.js +209 -0
- package/node_modules/undici/lib/api/api-upgrade.js +111 -0
- package/node_modules/undici/lib/api/index.js +7 -0
- package/node_modules/undici/lib/api/readable.js +580 -0
- package/node_modules/undici/lib/cache/memory-cache-store.js +279 -0
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +467 -0
- package/node_modules/undici/lib/core/connect.js +159 -0
- package/node_modules/undici/lib/core/constants.js +143 -0
- package/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/node_modules/undici/lib/core/errors.js +477 -0
- package/node_modules/undici/lib/core/request.js +485 -0
- package/node_modules/undici/lib/core/socks5-client.js +422 -0
- package/node_modules/undici/lib/core/socks5-utils.js +212 -0
- package/node_modules/undici/lib/core/symbols.js +76 -0
- package/node_modules/undici/lib/core/tree.js +160 -0
- package/node_modules/undici/lib/core/util.js +992 -0
- package/node_modules/undici/lib/dispatcher/agent.js +162 -0
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +221 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +1744 -0
- package/node_modules/undici/lib/dispatcher/client-h2.js +1056 -0
- package/node_modules/undici/lib/dispatcher/client.js +669 -0
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +196 -0
- package/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
- package/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
- package/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
- package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +260 -0
- package/node_modules/undici/lib/encoding/index.js +33 -0
- package/node_modules/undici/lib/global.js +59 -0
- package/node_modules/undici/lib/handler/cache-handler.js +824 -0
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
- package/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/node_modules/undici/lib/handler/deduplication-handler.js +504 -0
- package/node_modules/undici/lib/handler/redirect-handler.js +245 -0
- package/node_modules/undici/lib/handler/retry-handler.js +504 -0
- package/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
- package/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/node_modules/undici/lib/interceptor/cache.js +621 -0
- package/node_modules/undici/lib/interceptor/decompress.js +561 -0
- package/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
- package/node_modules/undici/lib/interceptor/dns.js +571 -0
- package/node_modules/undici/lib/interceptor/dump.js +99 -0
- package/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
- package/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/node_modules/undici/lib/mock/mock-agent.js +232 -0
- package/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/node_modules/undici/lib/mock/mock-utils.js +486 -0
- package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
- package/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
- package/node_modules/undici/lib/util/cache.js +676 -0
- package/node_modules/undici/lib/util/date.js +670 -0
- package/node_modules/undici/lib/util/promise.js +28 -0
- package/node_modules/undici/lib/util/runtime-features.js +124 -0
- package/node_modules/undici/lib/util/stats.js +32 -0
- package/node_modules/undici/lib/util/timers.js +425 -0
- package/node_modules/undici/lib/web/cache/cache.js +864 -0
- package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/node_modules/undici/lib/web/cache/util.js +45 -0
- package/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/node_modules/undici/lib/web/cookies/index.js +201 -0
- package/node_modules/undici/lib/web/cookies/parse.js +315 -0
- package/node_modules/undici/lib/web/cookies/util.js +371 -0
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +575 -0
- package/node_modules/undici/lib/web/eventsource/eventsource.js +504 -0
- package/node_modules/undici/lib/web/eventsource/util.js +29 -0
- package/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/node_modules/undici/lib/web/fetch/body.js +509 -0
- package/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
- package/node_modules/undici/lib/web/fetch/formdata.js +259 -0
- package/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/node_modules/undici/lib/web/fetch/index.js +2413 -0
- package/node_modules/undici/lib/web/fetch/request.js +1115 -0
- package/node_modules/undici/lib/web/fetch/response.js +641 -0
- package/node_modules/undici/lib/web/fetch/util.js +1522 -0
- package/node_modules/undici/lib/web/infra/index.js +243 -0
- package/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
- package/node_modules/undici/lib/web/webidl/index.js +1006 -0
- package/node_modules/undici/lib/web/websocket/connection.js +339 -0
- package/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/node_modules/undici/lib/web/websocket/frame.js +133 -0
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
- package/node_modules/undici/lib/web/websocket/receiver.js +520 -0
- package/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +496 -0
- package/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/node_modules/undici/lib/web/websocket/websocket.js +758 -0
- package/node_modules/undici/package.json +152 -0
- package/node_modules/undici/scripts/strip-comments.js +10 -0
- package/node_modules/undici/types/README.md +6 -0
- package/node_modules/undici/types/agent.d.ts +32 -0
- package/node_modules/undici/types/api.d.ts +43 -0
- package/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/node_modules/undici/types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici/types/cache.d.ts +36 -0
- package/node_modules/undici/types/client-stats.d.ts +15 -0
- package/node_modules/undici/types/client.d.ts +153 -0
- package/node_modules/undici/types/connector.d.ts +36 -0
- package/node_modules/undici/types/content-type.d.ts +21 -0
- package/node_modules/undici/types/cookies.d.ts +30 -0
- package/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici/types/dispatcher.d.ts +275 -0
- package/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici/types/errors.d.ts +177 -0
- package/node_modules/undici/types/eventsource.d.ts +66 -0
- package/node_modules/undici/types/fetch.d.ts +231 -0
- package/node_modules/undici/types/formdata.d.ts +114 -0
- package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici/types/global-origin.d.ts +7 -0
- package/node_modules/undici/types/h2c-client.d.ts +73 -0
- package/node_modules/undici/types/handlers.d.ts +14 -0
- package/node_modules/undici/types/header.d.ts +160 -0
- package/node_modules/undici/types/index.d.ts +91 -0
- package/node_modules/undici/types/interceptors.d.ts +82 -0
- package/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/node_modules/undici/types/mock-client.d.ts +27 -0
- package/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/node_modules/undici/types/mock-interceptor.d.ts +94 -0
- package/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/node_modules/undici/types/patch.d.ts +29 -0
- package/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/node_modules/undici/types/pool.d.ts +41 -0
- package/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/node_modules/undici/types/readable.d.ts +68 -0
- package/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/node_modules/undici/types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici/types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici/types/util.d.ts +18 -0
- package/node_modules/undici/types/utility.d.ts +7 -0
- package/node_modules/undici/types/webidl.d.ts +347 -0
- package/node_modules/undici/types/websocket.d.ts +188 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +17 -4
- package/webui/assets/group-bot-profile-CYK81678.jpg +0 -0
- package/webui/assets/group-bot-settings-BBQBbfgh.jpg +0 -0
- package/webui/assets/index-CuH0UYYo.js +28 -0
- package/webui/assets/index-DjbPiYmB.css +2 -0
- package/webui/favicon.ico +0 -0
- package/webui/index.html +26 -0
- package/webui/logo-128.webp +0 -0
- package/webui/logo-192.webp +0 -0
- package/webui/logo-256.webp +0 -0
- package/webui/logo-64.webp +0 -0
- package/webui/logo.jpg +0 -0
- package/webui/plugin-shared/plugin-sdk-webui.js +3 -0
- package/webui/plugin-shared/react-dom.js +3 -0
- package/webui/plugin-shared/react-jsx-runtime.js +3 -0
- package/webui/plugin-shared/react.js +3 -0
- package//344/275/277/347/224/250/350/257/264/346/230/216.txt +6 -0
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +1091 -0
- package/README.md +0 -3
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import type h from '@satorijs/element';
|
|
2
|
+
import type * as Universal from '@satorijs/protocol';
|
|
3
|
+
/** A user in an event, snake_case as on the wire. */
|
|
4
|
+
export interface NeutralUser {
|
|
5
|
+
id: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
nick?: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
is_bot?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** The event types the bots dispatch; plugins and other sources may add their own. */
|
|
12
|
+
export type EventName = 'message-created' | 'message-deleted' | 'message-updated' | 'guild-added' | 'guild-removed' | 'guild-updated' | 'guild-request' | 'guild-member-added' | 'guild-member-removed' | 'guild-member-updated' | 'guild-member-request' | 'friend-request' | 'friend-added' | 'friend-deleted' | 'reaction-added' | 'reaction-removed' | 'channel-added' | 'channel-updated' | 'channel-deleted' | 'interaction/button'
|
|
13
|
+
/** The platform's own event, as it is: `_type` and `_data` */
|
|
14
|
+
| 'internal' | (string & {});
|
|
15
|
+
/** A Satori event exactly as it goes over the wire (snake_case). Prefer the Session accessors. */
|
|
16
|
+
export interface NeutralEvent {
|
|
17
|
+
sn: number;
|
|
18
|
+
type: EventName;
|
|
19
|
+
self_id: string;
|
|
20
|
+
platform: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
user?: NeutralUser;
|
|
23
|
+
member?: {
|
|
24
|
+
user?: NeutralUser;
|
|
25
|
+
nick?: string;
|
|
26
|
+
avatar?: string;
|
|
27
|
+
roles?: {
|
|
28
|
+
id: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
}[];
|
|
31
|
+
joined_at?: number;
|
|
32
|
+
};
|
|
33
|
+
guild?: {
|
|
34
|
+
id: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
avatar?: string;
|
|
37
|
+
};
|
|
38
|
+
channel?: {
|
|
39
|
+
id: string;
|
|
40
|
+
type?: number;
|
|
41
|
+
name?: string;
|
|
42
|
+
parent_id?: string;
|
|
43
|
+
};
|
|
44
|
+
message?: {
|
|
45
|
+
id?: string;
|
|
46
|
+
content?: string;
|
|
47
|
+
created_at?: number;
|
|
48
|
+
quote?: NeutralResource;
|
|
49
|
+
};
|
|
50
|
+
/** Who did it, e.g. the admin who removed a member */
|
|
51
|
+
operator?: NeutralUser;
|
|
52
|
+
/** An `interaction/button` event's button */
|
|
53
|
+
button?: {
|
|
54
|
+
id: string;
|
|
55
|
+
data?: string;
|
|
56
|
+
};
|
|
57
|
+
/** What the source wants back to reply to this event; see SendOptions.referrer */
|
|
58
|
+
referrer?: unknown;
|
|
59
|
+
/** An `internal` event: `<platform>/<the platform's event name>`, e.g. `qq/group-msg-receive` */
|
|
60
|
+
_type?: string;
|
|
61
|
+
/** An `internal` event: the platform's data, as it came */
|
|
62
|
+
_data?: unknown;
|
|
63
|
+
[field: string]: any;
|
|
64
|
+
}
|
|
65
|
+
/** Any Satori resource (message, user, guild, member...) in its wire form. */
|
|
66
|
+
export type NeutralResource = Record<string, any>;
|
|
67
|
+
export interface SendOptions {
|
|
68
|
+
/** Id of the message to quote. */
|
|
69
|
+
quote?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The `referrer` of the event this answers, as in Satori: QQ official bots reply passively to that message or
|
|
72
|
+
* event instead of the latest one in the channel. `session.send()` and `session.reply()` pass it.
|
|
73
|
+
*/
|
|
74
|
+
referrer?: unknown;
|
|
75
|
+
/**
|
|
76
|
+
* Sent for a protocol client (the Satori adapter): `bot/before-send` and `bot/fallback` are skipped, so plugins
|
|
77
|
+
* cannot rewrite what a client sends; the built-in fallbacks still apply.
|
|
78
|
+
*/
|
|
79
|
+
relay?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* What a bot sends as the platform's own thing. The first four are elements beyond Satori's: one the bot lacks is
|
|
83
|
+
* swapped for its fallback before sending (a `bot/fallback` listener's, else the built-in one), so a plugin may
|
|
84
|
+
* send them anywhere. The others only say what the platform does.
|
|
85
|
+
*/
|
|
86
|
+
export type Feature =
|
|
87
|
+
/** `<markdown>`; without it, formatted text with the images and links kept */
|
|
88
|
+
'message.markdown'
|
|
89
|
+
/** `<button>`, `<button-group>`; without them, a line of what to send. Callback buttons are dropped */
|
|
90
|
+
| 'message.button'
|
|
91
|
+
/** `<card>` (CardAttrs); without it, the title with the link, the description and the image */
|
|
92
|
+
| 'message.card'
|
|
93
|
+
/** `<face>` (FaceAttrs); without it, `[name]` */
|
|
94
|
+
| 'message.face'
|
|
95
|
+
/** `<message forward>` */
|
|
96
|
+
| 'message.forward'
|
|
97
|
+
/**
|
|
98
|
+
* `<markdown stream>` builds one reply up part by part, and `<markdown stream="end">` is its last part; a stream
|
|
99
|
+
* left open ends 10 seconds after its last part. QQ official bots stream in C2C; in groups the parts go out
|
|
100
|
+
* together, as one message, once the stream ends.
|
|
101
|
+
*/
|
|
102
|
+
| 'message.stream'
|
|
103
|
+
/** Sending with no message to reply to. The QQ official bot can, within a monthly quota per user or group */
|
|
104
|
+
| 'message.proactive'
|
|
105
|
+
/** Satori's: a guild has no channels of its own, its id is its channel's, as with QQ groups */
|
|
106
|
+
| 'guild.plain';
|
|
107
|
+
/** `<card>`: a link shown as the platform's own card. */
|
|
108
|
+
export interface CardAttrs {
|
|
109
|
+
title: string;
|
|
110
|
+
url: string;
|
|
111
|
+
desc?: string;
|
|
112
|
+
/** Picture url */
|
|
113
|
+
image?: string;
|
|
114
|
+
/** What the chat list and the notification show */
|
|
115
|
+
prompt?: string;
|
|
116
|
+
}
|
|
117
|
+
/** `<face>`: a QQ system face, e.g. 13 for 呲牙. */
|
|
118
|
+
export interface FaceAttrs {
|
|
119
|
+
id: string;
|
|
120
|
+
/** Without brackets, e.g. 呲牙; what the fallback shows */
|
|
121
|
+
name?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* `<button>`, its label in the children; `<button-group>` around buttons starts a row. A command button, the kind
|
|
125
|
+
* every platform can do something with, sends `text` (default: the label) when clicked; the fallback asks to
|
|
126
|
+
* send it instead.
|
|
127
|
+
*/
|
|
128
|
+
export interface ButtonAttrs {
|
|
129
|
+
/**
|
|
130
|
+
* `link` opens `href`. `action` is a callback button: a click only brings an `interaction/button` event with
|
|
131
|
+
* this `id`, and the fallback drops it. Anything else (`input` too) makes a command button
|
|
132
|
+
*/
|
|
133
|
+
type?: 'link' | 'input' | 'action';
|
|
134
|
+
id?: string;
|
|
135
|
+
text?: string;
|
|
136
|
+
href?: string;
|
|
137
|
+
/** The QQ official bot's own button fields, which win over the ones above */
|
|
138
|
+
action?: {
|
|
139
|
+
type?: number;
|
|
140
|
+
data?: string;
|
|
141
|
+
[field: string]: unknown;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* One account on one platform. Only sendMessage is guaranteed; probe the rest, e.g.
|
|
146
|
+
* `if (bot.deleteMessage) ...`, since not every platform supports everything. The optional methods are Satori's,
|
|
147
|
+
* with its names and argument order (`@satorijs/protocol` Methods): the Satori adapter calls them by name.
|
|
148
|
+
*/
|
|
149
|
+
export interface Bot {
|
|
150
|
+
readonly platform: string;
|
|
151
|
+
readonly selfId: string;
|
|
152
|
+
/** `${platform}:${selfId}` */
|
|
153
|
+
readonly sid: string;
|
|
154
|
+
readonly status: Universal.Status;
|
|
155
|
+
readonly features: readonly Feature[];
|
|
156
|
+
/** The account itself, as a Satori user. */
|
|
157
|
+
readonly user?: NeutralResource;
|
|
158
|
+
/**
|
|
159
|
+
* The platform's own API, for what has no Satori method. The QQ account (`ntqq`): the OneBot 11 actions
|
|
160
|
+
* with the go-cqhttp and LLOneBot extensions, camelCased (`set_group_card` is `setGroupCard`), one object of the
|
|
161
|
+
* OneBot parameters, resolving to the action's `data` and rejecting with its error; a `message_id` may be a
|
|
162
|
+
* `session.messageId`. The QQ official bot: its REST API.
|
|
163
|
+
*/
|
|
164
|
+
readonly internal?: Record<string, (...args: any[]) => Promise<any>>;
|
|
165
|
+
sendMessage(channelId: string, content: h.Fragment, options?: SendOptions): Promise<NeutralResource[]>;
|
|
166
|
+
sendPrivateMessage?(userId: string, content: h.Fragment, options?: SendOptions): Promise<NeutralResource[]>;
|
|
167
|
+
getMessage?(channelId: string, messageId: string): Promise<NeutralResource>;
|
|
168
|
+
deleteMessage?(channelId: string, messageId: string): Promise<void>;
|
|
169
|
+
/** `next`: the `next` of the page before. */
|
|
170
|
+
getMessageList?(channelId: string, next?: string, direction?: string, limit?: number, order?: 'asc' | 'desc'): Promise<NeutralList>;
|
|
171
|
+
getUser?(userId: string): Promise<NeutralResource>;
|
|
172
|
+
getFriendList?(next?: string): Promise<NeutralList>;
|
|
173
|
+
deleteFriend?(userId: string): Promise<void>;
|
|
174
|
+
/** Answers a `friend-request` event; `messageId` is the event's message id. */
|
|
175
|
+
handleFriendRequest?(messageId: string, approve: boolean, comment?: string): Promise<void>;
|
|
176
|
+
getGuild?(guildId: string): Promise<NeutralResource>;
|
|
177
|
+
getGuildList?(next?: string): Promise<NeutralList>;
|
|
178
|
+
/** Answers a `guild-request` event, an invitation to join a guild. */
|
|
179
|
+
handleGuildRequest?(messageId: string, approve: boolean, comment?: string): Promise<void>;
|
|
180
|
+
getChannel?(channelId: string, guildId?: string): Promise<NeutralResource>;
|
|
181
|
+
getChannelList?(guildId: string, next?: string): Promise<NeutralList>;
|
|
182
|
+
createChannel?(guildId: string, data: NeutralResource): Promise<NeutralResource>;
|
|
183
|
+
updateChannel?(channelId: string, data: NeutralResource): Promise<void>;
|
|
184
|
+
/** On QQ, leaving the group. */
|
|
185
|
+
deleteChannel?(channelId: string): Promise<void>;
|
|
186
|
+
/** Mutes everyone but the admins, or lifts it. */
|
|
187
|
+
muteChannel?(channelId: string, guildId?: string, enable?: boolean): Promise<void>;
|
|
188
|
+
createDirectChannel?(userId: string, guildId?: string): Promise<NeutralResource>;
|
|
189
|
+
getGuildMember?(guildId: string, userId: string): Promise<NeutralResource>;
|
|
190
|
+
getGuildMemberList?(guildId: string, next?: string): Promise<NeutralList>;
|
|
191
|
+
/** `duration` in milliseconds. */
|
|
192
|
+
muteGuildMember?(guildId: string, userId: string, duration: number): Promise<void>;
|
|
193
|
+
kickGuildMember?(guildId: string, userId: string, permanent?: boolean): Promise<void>;
|
|
194
|
+
/** Answers a `guild-member-request` event; `messageId` is the event's message id. */
|
|
195
|
+
handleGuildMemberRequest?(messageId: string, approve: boolean, comment?: string): Promise<void>;
|
|
196
|
+
/** The role ids are the ones in a member's `roles`. */
|
|
197
|
+
getGuildRoleList?(guildId: string, next?: string): Promise<NeutralList>;
|
|
198
|
+
setGuildMemberRole?(guildId: string, userId: string, roleId: string): Promise<void>;
|
|
199
|
+
unsetGuildMemberRole?(guildId: string, userId: string, roleId: string): Promise<void>;
|
|
200
|
+
/** Puts the commands on the platform's command menu, where it has one (the QQ official bot's slash menus). */
|
|
201
|
+
updateCommands?(commands: Universal.Command[]): Promise<void>;
|
|
202
|
+
createReaction?(channelId: string, messageId: string, emoji: string): Promise<void>;
|
|
203
|
+
deleteReaction?(channelId: string, messageId: string, emoji: string): Promise<void>;
|
|
204
|
+
getReactionList?(channelId: string, messageId: string, emoji: string, next?: string): Promise<NeutralList>;
|
|
205
|
+
}
|
|
206
|
+
/** A page of resources; `next` fetches the following one. */
|
|
207
|
+
export interface NeutralList {
|
|
208
|
+
data: NeutralResource[];
|
|
209
|
+
next?: string;
|
|
210
|
+
}
|
|
211
|
+
export interface Session {
|
|
212
|
+
readonly bot: Bot;
|
|
213
|
+
readonly event: NeutralEvent;
|
|
214
|
+
readonly type: EventName;
|
|
215
|
+
readonly platform: string;
|
|
216
|
+
readonly selfId: string;
|
|
217
|
+
readonly timestamp: number;
|
|
218
|
+
readonly userId?: string;
|
|
219
|
+
readonly channelId?: string;
|
|
220
|
+
readonly guildId?: string;
|
|
221
|
+
readonly messageId?: string;
|
|
222
|
+
readonly isDirect: boolean;
|
|
223
|
+
/** Satori element markup; empty for events without a message. */
|
|
224
|
+
readonly content: string;
|
|
225
|
+
readonly elements: h[];
|
|
226
|
+
/**
|
|
227
|
+
* The message as a command reads it: a leading quote, the @ of this bot and the blank after them taken off.
|
|
228
|
+
* `atSelf`: the bot was @-ed there. In groups the QQ official bot only gets messages that start with its @.
|
|
229
|
+
*/
|
|
230
|
+
readonly stripped: {
|
|
231
|
+
readonly content: string;
|
|
232
|
+
readonly atSelf: boolean;
|
|
233
|
+
};
|
|
234
|
+
send(content: h.Fragment): Promise<NeutralResource[]>;
|
|
235
|
+
/** Sends to the same channel, quoting the message that triggered the session. */
|
|
236
|
+
reply(content: h.Fragment): Promise<NeutralResource[]>;
|
|
237
|
+
/**
|
|
238
|
+
* Sends after what the channel has queued before, then holds the queue for `delay` ms (default 1000): for several
|
|
239
|
+
* messages in a row, which QQ takes for spam when they come too fast.
|
|
240
|
+
*/
|
|
241
|
+
sendQueued(content: h.Fragment, delay?: number): Promise<NeutralResource[]>;
|
|
242
|
+
/**
|
|
243
|
+
* The next message the same user sends in this channel, as its `stripped.content`; undefined after `timeout` ms
|
|
244
|
+
* (default 60000). That message reaches no plugin. In groups the QQ official bot only gets messages that @ it, so
|
|
245
|
+
* the answer has to @ it as well.
|
|
246
|
+
*/
|
|
247
|
+
prompt(timeout?: number): Promise<string | undefined>;
|
|
248
|
+
}
|
|
249
|
+
export interface Bots extends Iterable<Bot> {
|
|
250
|
+
readonly size: number;
|
|
251
|
+
get(sid: string): Bot | undefined;
|
|
252
|
+
/** For adapter plugins: lists the bot until the calling plugin is disposed. */
|
|
253
|
+
register(bot: Bot): () => void;
|
|
254
|
+
/** For adapter plugins: hands an incoming event to the plugin chain. */
|
|
255
|
+
dispatch(bot: Bot, event: NeutralEvent): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* For adapter plugins: runs `bot/before-send`, swaps what the bot does not declare in `features` for its fallback
|
|
258
|
+
* (`bot/fallback`), and returns the content to actually send. Pass on the `options` of sendMessage (`relay`).
|
|
259
|
+
*/
|
|
260
|
+
beforeSend(bot: Bot, channelId: string, content: h[], options?: SendOptions): Promise<h[]>;
|
|
261
|
+
}
|
|
262
|
+
declare module 'cordis' {
|
|
263
|
+
interface Context {
|
|
264
|
+
bots: Bots;
|
|
265
|
+
}
|
|
266
|
+
interface Events {
|
|
267
|
+
/**
|
|
268
|
+
* @mode parallel. Every event, before any routing and out of reach of middleware. For transports
|
|
269
|
+
* and logging, which must see what the middleware chain may swallow.
|
|
270
|
+
*/
|
|
271
|
+
'bot/session'(session: Session): void;
|
|
272
|
+
/**
|
|
273
|
+
* @mode waterfall. Messages from others, through every listener in registration order. A
|
|
274
|
+
* listener that does not call next() swallows the message for all listeners after it.
|
|
275
|
+
* The bot's own messages never come here, they go to `bot/event`.
|
|
276
|
+
*/
|
|
277
|
+
'bot/message'(session: Session, next: () => Promise<void>): void | Promise<void>;
|
|
278
|
+
/** @mode parallel. Every other event, including the bot's own messages. */
|
|
279
|
+
'bot/event'(session: Session): void;
|
|
280
|
+
/**
|
|
281
|
+
* @mode parallel. A bot was registered, unregistered, or changed status.
|
|
282
|
+
* `ctx.bots.get(bot.sid) === bot` tells whether this bot is still registered.
|
|
283
|
+
*/
|
|
284
|
+
'bot/status'(bot: Bot): void;
|
|
285
|
+
/**
|
|
286
|
+
* @mode waterfall. Sees what bot.sendMessage is about to send: mutate `content` in place or
|
|
287
|
+
* transform the result of next(); resolve to [] to cancel. Messages sent by OneBot, Milky or
|
|
288
|
+
* Satori clients do not pass through here.
|
|
289
|
+
*/
|
|
290
|
+
'bot/before-send'(bot: Bot, channelId: string, content: h[], next: () => Promise<h[]>): h[] | Promise<h[]>;
|
|
291
|
+
/**
|
|
292
|
+
* @mode serial. After `bot/before-send`, once for each `markdown` / `card` / `face` element and each row of
|
|
293
|
+
* buttons the bot cannot send (see Feature): return what to send instead, e.g. the markdown rendered to an
|
|
294
|
+
* image, or nothing to leave it to the built-in fallback. The first listener to return something wins; what it
|
|
295
|
+
* returns goes out as it is.
|
|
296
|
+
*/
|
|
297
|
+
'bot/fallback'(bot: Bot, channelId: string, element: h): h.Fragment | void | Promise<h.Fragment | void>;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|