From 27671456120ad08c20e3aec4ba2d9964e30c403f Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 1 Oct 2025 22:50:58 +0300 Subject: [PATCH] upd --- Jenkinsfile | 96 + deploy.sh | 13 + node_modules/.bin/telegraf | 1 + node_modules/.package-lock.json | 192 ++ node_modules/@telegraf/types/LICENSE | 21 + node_modules/@telegraf/types/README.md | 113 ++ node_modules/@telegraf/types/api.d.ts | 22 + node_modules/@telegraf/types/default.d.ts | 40 + node_modules/@telegraf/types/index.d.ts | 10 + node_modules/@telegraf/types/inline.d.ts | 697 +++++++ node_modules/@telegraf/types/manage.d.ts | 594 ++++++ node_modules/@telegraf/types/markup.d.ts | 228 +++ node_modules/@telegraf/types/message.d.ts | 1087 ++++++++++ node_modules/@telegraf/types/methods.d.ts | 1579 +++++++++++++++ node_modules/@telegraf/types/package.json | 36 + node_modules/@telegraf/types/passport.d.ts | 163 ++ node_modules/@telegraf/types/payment.d.ts | 101 + node_modules/@telegraf/types/settings.d.ts | 120 ++ node_modules/@telegraf/types/update.d.ts | 113 ++ node_modules/abort-controller/LICENSE | 21 + node_modules/abort-controller/README.md | 98 + node_modules/abort-controller/browser.js | 13 + node_modules/abort-controller/browser.mjs | 11 + .../dist/abort-controller.d.ts | 43 + .../abort-controller/dist/abort-controller.js | 127 ++ .../dist/abort-controller.js.map | 1 + .../dist/abort-controller.mjs | 118 ++ .../dist/abort-controller.mjs.map | 1 + .../dist/abort-controller.umd.js | 5 + .../dist/abort-controller.umd.js.map | 1 + node_modules/abort-controller/package.json | 97 + node_modules/abort-controller/polyfill.js | 21 + node_modules/abort-controller/polyfill.mjs | 19 + node_modules/buffer-alloc-unsafe/index.js | 17 + node_modules/buffer-alloc-unsafe/package.json | 24 + node_modules/buffer-alloc-unsafe/readme.md | 46 + node_modules/buffer-alloc/index.js | 32 + node_modules/buffer-alloc/package.json | 26 + node_modules/buffer-alloc/readme.md | 43 + node_modules/buffer-fill/index.js | 113 ++ node_modules/buffer-fill/package.json | 16 + node_modules/buffer-fill/readme.md | 54 + node_modules/debug/LICENSE | 20 + node_modules/debug/README.md | 481 +++++ node_modules/debug/package.json | 64 + node_modules/debug/src/browser.js | 272 +++ node_modules/debug/src/common.js | 292 +++ node_modules/debug/src/index.js | 10 + node_modules/debug/src/node.js | 263 +++ node_modules/dotenv/CHANGELOG.md | 520 +++++ node_modules/dotenv/LICENSE | 23 + node_modules/dotenv/README-es.md | 411 ++++ node_modules/dotenv/README.md | 645 ++++++ node_modules/dotenv/SECURITY.md | 1 + node_modules/dotenv/config.d.ts | 1 + node_modules/dotenv/config.js | 9 + node_modules/dotenv/lib/cli-options.js | 17 + node_modules/dotenv/lib/env-options.js | 28 + node_modules/dotenv/lib/main.d.ts | 162 ++ node_modules/dotenv/lib/main.js | 386 ++++ node_modules/dotenv/package.json | 62 + node_modules/event-target-shim/LICENSE | 22 + node_modules/event-target-shim/README.md | 293 +++ .../dist/event-target-shim.js | 871 ++++++++ .../dist/event-target-shim.js.map | 1 + .../dist/event-target-shim.mjs | 862 ++++++++ .../dist/event-target-shim.mjs.map | 1 + .../dist/event-target-shim.umd.js | 6 + .../dist/event-target-shim.umd.js.map | 1 + node_modules/event-target-shim/index.d.ts | 399 ++++ node_modules/event-target-shim/package.json | 82 + node_modules/mri/index.d.ts | 21 + node_modules/mri/lib/index.js | 119 ++ node_modules/mri/lib/index.mjs | 119 ++ node_modules/mri/license.md | 21 + node_modules/mri/package.json | 43 + node_modules/mri/readme.md | 166 ++ node_modules/ms/index.js | 162 ++ node_modules/ms/license.md | 21 + node_modules/ms/package.json | 38 + node_modules/ms/readme.md | 59 + node_modules/node-fetch/LICENSE.md | 22 + node_modules/node-fetch/README.md | 634 ++++++ node_modules/node-fetch/browser.js | 25 + node_modules/node-fetch/lib/index.es.js | 1777 ++++++++++++++++ node_modules/node-fetch/lib/index.js | 1787 +++++++++++++++++ node_modules/node-fetch/lib/index.mjs | 1775 ++++++++++++++++ node_modules/node-fetch/package.json | 89 + node_modules/p-timeout/index.d.ts | 113 ++ node_modules/p-timeout/index.js | 71 + node_modules/p-timeout/license | 9 + node_modules/p-timeout/package.json | 44 + node_modules/p-timeout/readme.md | 117 ++ node_modules/safe-compare/.npmignore | 44 + node_modules/safe-compare/LICENSE | 21 + node_modules/safe-compare/README.md | 58 + node_modules/safe-compare/appveyor.yml | 56 + node_modules/safe-compare/index.js | 75 + node_modules/safe-compare/package.json | 46 + node_modules/sandwich-stream/.editorconfig | 13 + node_modules/sandwich-stream/LICENCE | 13 + node_modules/sandwich-stream/README.md | 58 + .../sandwich-stream/dist/sandwich-stream.d.ts | 107 + .../dist/sandwich-stream.d.ts.map | 1 + .../sandwich-stream/dist/sandwich-stream.js | 185 ++ .../sandwich-stream/dist/sandwich-stream.mjs | 181 ++ node_modules/sandwich-stream/package.json | 72 + node_modules/sandwich-stream/rollup.config.js | 40 + node_modules/telegraf/LICENSE | 22 + node_modules/telegraf/README.md | 393 ++++ node_modules/telegraf/filters.d.ts | 1 + node_modules/telegraf/filters.js | 1 + node_modules/telegraf/format.d.ts | 1 + node_modules/telegraf/format.js | 1 + node_modules/telegraf/future.d.ts | 1 + node_modules/telegraf/future.js | 1 + node_modules/telegraf/lib/button.js | 101 + node_modules/telegraf/lib/cli.mjs | 105 + node_modules/telegraf/lib/composer.js | 582 ++++++ node_modules/telegraf/lib/context.js | 1219 +++++++++++ .../telegraf/lib/core/helpers/args.js | 58 + .../telegraf/lib/core/helpers/check.js | 56 + .../telegraf/lib/core/helpers/compact.js | 17 + .../telegraf/lib/core/helpers/deunionize.js | 13 + .../telegraf/lib/core/helpers/formatting.js | 91 + .../telegraf/lib/core/helpers/util.js | 50 + .../telegraf/lib/core/network/client.js | 320 +++ .../telegraf/lib/core/network/error.js | 21 + .../lib/core/network/multipart-stream.js | 61 + .../telegraf/lib/core/network/polling.js | 87 + .../telegraf/lib/core/network/webhook.js | 54 + .../telegraf/lib/core/types/typegram.js | 27 + node_modules/telegraf/lib/filters.js | 69 + node_modules/telegraf/lib/format.js | 38 + node_modules/telegraf/lib/future.js | 150 ++ node_modules/telegraf/lib/index.js | 48 + node_modules/telegraf/lib/input.js | 61 + node_modules/telegraf/lib/markup.js | 111 + node_modules/telegraf/lib/middleware.js | 2 + node_modules/telegraf/lib/reactions.js | 84 + node_modules/telegraf/lib/router.js | 46 + node_modules/telegraf/lib/scenes.js | 17 + node_modules/telegraf/lib/scenes/base.js | 39 + node_modules/telegraf/lib/scenes/context.js | 104 + node_modules/telegraf/lib/scenes/index.js | 21 + node_modules/telegraf/lib/scenes/stage.js | 49 + .../telegraf/lib/scenes/wizard/context.js | 31 + .../telegraf/lib/scenes/wizard/index.js | 45 + node_modules/telegraf/lib/session.js | 166 ++ node_modules/telegraf/lib/telegraf.js | 246 +++ node_modules/telegraf/lib/telegram-types.js | 6 + node_modules/telegraf/lib/telegram.js | 1240 ++++++++++++ node_modules/telegraf/lib/types.js | 2 + node_modules/telegraf/lib/utils.js | 5 + node_modules/telegraf/markup.d.ts | 1 + node_modules/telegraf/markup.js | 1 + node_modules/telegraf/package.json | 134 ++ node_modules/telegraf/scenes.d.ts | 1 + node_modules/telegraf/scenes.js | 1 + node_modules/telegraf/session.d.ts | 1 + node_modules/telegraf/session.js | 1 + node_modules/telegraf/src/button.ts | 182 ++ node_modules/telegraf/src/composer.ts | 1008 ++++++++++ node_modules/telegraf/src/context.ts | 1663 +++++++++++++++ .../telegraf/src/core/helpers/args.ts | 63 + .../telegraf/src/core/helpers/check.ts | 71 + .../telegraf/src/core/helpers/compact.ts | 18 + .../telegraf/src/core/helpers/deunionize.ts | 26 + .../telegraf/src/core/helpers/formatting.ts | 119 ++ .../telegraf/src/core/helpers/util.ts | 96 + .../telegraf/src/core/network/client.ts | 396 ++++ .../telegraf/src/core/network/error.ts | 29 + .../src/core/network/multipart-stream.ts | 45 + .../telegraf/src/core/network/polling.ts | 94 + .../telegraf/src/core/network/webhook.ts | 58 + .../telegraf/src/core/types/typegram.ts | 54 + node_modules/telegraf/src/filters.ts | 109 + node_modules/telegraf/src/format.ts | 110 + node_modules/telegraf/src/future.ts | 213 ++ node_modules/telegraf/src/index.ts | 17 + node_modules/telegraf/src/input.ts | 59 + node_modules/telegraf/src/markup.ts | 142 ++ node_modules/telegraf/src/middleware.ts | 24 + node_modules/telegraf/src/reactions.ts | 118 ++ node_modules/telegraf/src/router.ts | 55 + node_modules/telegraf/src/scenes.ts | 1 + node_modules/telegraf/src/scenes/base.ts | 52 + node_modules/telegraf/src/scenes/context.ts | 136 ++ node_modules/telegraf/src/scenes/index.ts | 21 + node_modules/telegraf/src/scenes/stage.ts | 71 + .../telegraf/src/scenes/wizard/context.ts | 58 + .../telegraf/src/scenes/wizard/index.ts | 63 + node_modules/telegraf/src/session.ts | 204 ++ node_modules/telegraf/src/telegraf.ts | 354 ++++ node_modules/telegraf/src/telegram-types.ts | 219 ++ node_modules/telegraf/src/telegram.ts | 1635 +++++++++++++++ node_modules/telegraf/src/types.ts | 2 + node_modules/telegraf/src/utils.ts | 1 + node_modules/telegraf/types.d.ts | 1 + node_modules/telegraf/types.js | 1 + node_modules/telegraf/typings/button.d.ts | 36 + node_modules/telegraf/typings/button.d.ts.map | 1 + node_modules/telegraf/typings/composer.d.ts | 227 +++ .../telegraf/typings/composer.d.ts.map | 1 + node_modules/telegraf/typings/context.d.ts | 655 ++++++ .../telegraf/typings/context.d.ts.map | 1 + .../telegraf/typings/core/helpers/args.d.ts | 11 + .../typings/core/helpers/args.d.ts.map | 1 + .../telegraf/typings/core/helpers/check.d.ts | 56 + .../typings/core/helpers/check.d.ts.map | 1 + .../typings/core/helpers/compact.d.ts | 4 + .../typings/core/helpers/compact.d.ts.map | 1 + .../typings/core/helpers/deunionize.d.ts | 18 + .../typings/core/helpers/deunionize.d.ts.map | 1 + .../typings/core/helpers/formatting.d.ts | 30 + .../typings/core/helpers/formatting.d.ts.map | 1 + .../telegraf/typings/core/helpers/util.d.ts | 27 + .../typings/core/helpers/util.d.ts.map | 1 + .../telegraf/typings/core/network/client.d.ts | 55 + .../typings/core/network/client.d.ts.map | 1 + .../telegraf/typings/core/network/error.d.ts | 16 + .../typings/core/network/error.d.ts.map | 1 + .../core/network/multipart-stream.d.ts | 19 + .../core/network/multipart-stream.d.ts.map | 1 + .../typings/core/network/polling.d.ts | 16 + .../typings/core/network/polling.d.ts.map | 1 + .../typings/core/network/webhook.d.ts | 7 + .../typings/core/network/webhook.d.ts.map | 1 + .../telegraf/typings/core/types/typegram.d.ts | 44 + .../typings/core/types/typegram.d.ts.map | 1 + node_modules/telegraf/typings/filters.d.ts | 18 + .../telegraf/typings/filters.d.ts.map | 1 + node_modules/telegraf/typings/format.d.ts | 22 + node_modules/telegraf/typings/format.d.ts.map | 1 + node_modules/telegraf/typings/future.d.ts | 12 + node_modules/telegraf/typings/future.d.ts.map | 1 + node_modules/telegraf/typings/index.d.ts | 15 + node_modules/telegraf/typings/index.d.ts.map | 1 + node_modules/telegraf/typings/input.d.ts | 55 + node_modules/telegraf/typings/input.d.ts.map | 1 + node_modules/telegraf/typings/markup.d.ts | 27 + node_modules/telegraf/typings/markup.d.ts.map | 1 + node_modules/telegraf/typings/middleware.d.ts | 8 + .../telegraf/typings/middleware.d.ts.map | 1 + node_modules/telegraf/typings/reactions.d.ts | 32 + .../telegraf/typings/reactions.d.ts.map | 1 + node_modules/telegraf/typings/router.d.ts | 21 + node_modules/telegraf/typings/router.d.ts.map | 1 + node_modules/telegraf/typings/scenes.d.ts | 2 + node_modules/telegraf/typings/scenes.d.ts.map | 1 + .../telegraf/typings/scenes/base.d.ts | 22 + .../telegraf/typings/scenes/base.d.ts.map | 1 + .../telegraf/typings/scenes/context.d.ts | 36 + .../telegraf/typings/scenes/context.d.ts.map | 1 + .../telegraf/typings/scenes/index.d.ts | 11 + .../telegraf/typings/scenes/index.d.ts.map | 1 + .../telegraf/typings/scenes/stage.d.ts | 24 + .../telegraf/typings/scenes/stage.d.ts.map | 1 + .../typings/scenes/wizard/context.d.ts | 29 + .../typings/scenes/wizard/context.d.ts.map | 1 + .../telegraf/typings/scenes/wizard/index.d.ts | 16 + .../typings/scenes/wizard/index.d.ts.map | 1 + node_modules/telegraf/typings/session.d.ts | 55 + .../telegraf/typings/session.d.ts.map | 1 + node_modules/telegraf/typings/telegraf.d.ts | 117 ++ .../telegraf/typings/telegraf.d.ts.map | 1 + .../telegraf/typings/telegram-types.d.ts | 117 ++ .../telegraf/typings/telegram-types.d.ts.map | 1 + node_modules/telegraf/typings/telegram.d.ts | 681 +++++++ .../telegraf/typings/telegram.d.ts.map | 1 + node_modules/telegraf/typings/types.d.ts | 3 + node_modules/telegraf/typings/types.d.ts.map | 1 + node_modules/telegraf/typings/utils.d.ts | 2 + node_modules/telegraf/typings/utils.d.ts.map | 1 + node_modules/telegraf/utils.d.ts | 1 + node_modules/telegraf/utils.js | 1 + node_modules/tr46/.npmignore | 4 + node_modules/tr46/index.js | 193 ++ node_modules/tr46/lib/.gitkeep | 0 node_modules/tr46/lib/mappingTable.json | 1 + node_modules/tr46/package.json | 31 + node_modules/webidl-conversions/LICENSE.md | 12 + node_modules/webidl-conversions/README.md | 53 + node_modules/webidl-conversions/lib/index.js | 189 ++ node_modules/webidl-conversions/package.json | 23 + node_modules/whatwg-url/LICENSE.txt | 21 + node_modules/whatwg-url/README.md | 67 + node_modules/whatwg-url/lib/URL-impl.js | 200 ++ node_modules/whatwg-url/lib/URL.js | 196 ++ node_modules/whatwg-url/lib/public-api.js | 11 + .../whatwg-url/lib/url-state-machine.js | 1297 ++++++++++++ node_modules/whatwg-url/lib/utils.js | 20 + node_modules/whatwg-url/package.json | 32 + package-lock.json | 201 ++ package.json | 10 + tg_filebrowser_bot.js | 108 + 296 files changed, 39425 insertions(+) create mode 100644 Jenkinsfile create mode 100755 deploy.sh create mode 120000 node_modules/.bin/telegraf create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/@telegraf/types/LICENSE create mode 100644 node_modules/@telegraf/types/README.md create mode 100644 node_modules/@telegraf/types/api.d.ts create mode 100644 node_modules/@telegraf/types/default.d.ts create mode 100644 node_modules/@telegraf/types/index.d.ts create mode 100644 node_modules/@telegraf/types/inline.d.ts create mode 100644 node_modules/@telegraf/types/manage.d.ts create mode 100644 node_modules/@telegraf/types/markup.d.ts create mode 100644 node_modules/@telegraf/types/message.d.ts create mode 100644 node_modules/@telegraf/types/methods.d.ts create mode 100644 node_modules/@telegraf/types/package.json create mode 100644 node_modules/@telegraf/types/passport.d.ts create mode 100644 node_modules/@telegraf/types/payment.d.ts create mode 100644 node_modules/@telegraf/types/settings.d.ts create mode 100644 node_modules/@telegraf/types/update.d.ts create mode 100644 node_modules/abort-controller/LICENSE create mode 100644 node_modules/abort-controller/README.md create mode 100644 node_modules/abort-controller/browser.js create mode 100644 node_modules/abort-controller/browser.mjs create mode 100644 node_modules/abort-controller/dist/abort-controller.d.ts create mode 100644 node_modules/abort-controller/dist/abort-controller.js create mode 100644 node_modules/abort-controller/dist/abort-controller.js.map create mode 100644 node_modules/abort-controller/dist/abort-controller.mjs create mode 100644 node_modules/abort-controller/dist/abort-controller.mjs.map create mode 100644 node_modules/abort-controller/dist/abort-controller.umd.js create mode 100644 node_modules/abort-controller/dist/abort-controller.umd.js.map create mode 100644 node_modules/abort-controller/package.json create mode 100644 node_modules/abort-controller/polyfill.js create mode 100644 node_modules/abort-controller/polyfill.mjs create mode 100644 node_modules/buffer-alloc-unsafe/index.js create mode 100644 node_modules/buffer-alloc-unsafe/package.json create mode 100644 node_modules/buffer-alloc-unsafe/readme.md create mode 100644 node_modules/buffer-alloc/index.js create mode 100644 node_modules/buffer-alloc/package.json create mode 100644 node_modules/buffer-alloc/readme.md create mode 100644 node_modules/buffer-fill/index.js create mode 100644 node_modules/buffer-fill/package.json create mode 100644 node_modules/buffer-fill/readme.md create mode 100644 node_modules/debug/LICENSE create mode 100644 node_modules/debug/README.md create mode 100644 node_modules/debug/package.json create mode 100644 node_modules/debug/src/browser.js create mode 100644 node_modules/debug/src/common.js create mode 100644 node_modules/debug/src/index.js create mode 100644 node_modules/debug/src/node.js create mode 100644 node_modules/dotenv/CHANGELOG.md create mode 100644 node_modules/dotenv/LICENSE create mode 100644 node_modules/dotenv/README-es.md create mode 100644 node_modules/dotenv/README.md create mode 100644 node_modules/dotenv/SECURITY.md create mode 100644 node_modules/dotenv/config.d.ts create mode 100644 node_modules/dotenv/config.js create mode 100644 node_modules/dotenv/lib/cli-options.js create mode 100644 node_modules/dotenv/lib/env-options.js create mode 100644 node_modules/dotenv/lib/main.d.ts create mode 100644 node_modules/dotenv/lib/main.js create mode 100644 node_modules/dotenv/package.json create mode 100644 node_modules/event-target-shim/LICENSE create mode 100644 node_modules/event-target-shim/README.md create mode 100644 node_modules/event-target-shim/dist/event-target-shim.js create mode 100644 node_modules/event-target-shim/dist/event-target-shim.js.map create mode 100644 node_modules/event-target-shim/dist/event-target-shim.mjs create mode 100644 node_modules/event-target-shim/dist/event-target-shim.mjs.map create mode 100644 node_modules/event-target-shim/dist/event-target-shim.umd.js create mode 100644 node_modules/event-target-shim/dist/event-target-shim.umd.js.map create mode 100644 node_modules/event-target-shim/index.d.ts create mode 100644 node_modules/event-target-shim/package.json create mode 100644 node_modules/mri/index.d.ts create mode 100644 node_modules/mri/lib/index.js create mode 100644 node_modules/mri/lib/index.mjs create mode 100644 node_modules/mri/license.md create mode 100644 node_modules/mri/package.json create mode 100644 node_modules/mri/readme.md create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/node-fetch/LICENSE.md create mode 100644 node_modules/node-fetch/README.md create mode 100644 node_modules/node-fetch/browser.js create mode 100644 node_modules/node-fetch/lib/index.es.js create mode 100644 node_modules/node-fetch/lib/index.js create mode 100644 node_modules/node-fetch/lib/index.mjs create mode 100644 node_modules/node-fetch/package.json create mode 100644 node_modules/p-timeout/index.d.ts create mode 100644 node_modules/p-timeout/index.js create mode 100644 node_modules/p-timeout/license create mode 100644 node_modules/p-timeout/package.json create mode 100644 node_modules/p-timeout/readme.md create mode 100644 node_modules/safe-compare/.npmignore create mode 100644 node_modules/safe-compare/LICENSE create mode 100644 node_modules/safe-compare/README.md create mode 100644 node_modules/safe-compare/appveyor.yml create mode 100644 node_modules/safe-compare/index.js create mode 100644 node_modules/safe-compare/package.json create mode 100644 node_modules/sandwich-stream/.editorconfig create mode 100644 node_modules/sandwich-stream/LICENCE create mode 100644 node_modules/sandwich-stream/README.md create mode 100644 node_modules/sandwich-stream/dist/sandwich-stream.d.ts create mode 100644 node_modules/sandwich-stream/dist/sandwich-stream.d.ts.map create mode 100644 node_modules/sandwich-stream/dist/sandwich-stream.js create mode 100644 node_modules/sandwich-stream/dist/sandwich-stream.mjs create mode 100644 node_modules/sandwich-stream/package.json create mode 100644 node_modules/sandwich-stream/rollup.config.js create mode 100644 node_modules/telegraf/LICENSE create mode 100644 node_modules/telegraf/README.md create mode 100644 node_modules/telegraf/filters.d.ts create mode 100644 node_modules/telegraf/filters.js create mode 100644 node_modules/telegraf/format.d.ts create mode 100644 node_modules/telegraf/format.js create mode 100644 node_modules/telegraf/future.d.ts create mode 100644 node_modules/telegraf/future.js create mode 100644 node_modules/telegraf/lib/button.js create mode 100755 node_modules/telegraf/lib/cli.mjs create mode 100644 node_modules/telegraf/lib/composer.js create mode 100644 node_modules/telegraf/lib/context.js create mode 100644 node_modules/telegraf/lib/core/helpers/args.js create mode 100644 node_modules/telegraf/lib/core/helpers/check.js create mode 100644 node_modules/telegraf/lib/core/helpers/compact.js create mode 100644 node_modules/telegraf/lib/core/helpers/deunionize.js create mode 100644 node_modules/telegraf/lib/core/helpers/formatting.js create mode 100644 node_modules/telegraf/lib/core/helpers/util.js create mode 100644 node_modules/telegraf/lib/core/network/client.js create mode 100644 node_modules/telegraf/lib/core/network/error.js create mode 100644 node_modules/telegraf/lib/core/network/multipart-stream.js create mode 100644 node_modules/telegraf/lib/core/network/polling.js create mode 100644 node_modules/telegraf/lib/core/network/webhook.js create mode 100644 node_modules/telegraf/lib/core/types/typegram.js create mode 100644 node_modules/telegraf/lib/filters.js create mode 100644 node_modules/telegraf/lib/format.js create mode 100644 node_modules/telegraf/lib/future.js create mode 100644 node_modules/telegraf/lib/index.js create mode 100644 node_modules/telegraf/lib/input.js create mode 100644 node_modules/telegraf/lib/markup.js create mode 100644 node_modules/telegraf/lib/middleware.js create mode 100644 node_modules/telegraf/lib/reactions.js create mode 100644 node_modules/telegraf/lib/router.js create mode 100644 node_modules/telegraf/lib/scenes.js create mode 100644 node_modules/telegraf/lib/scenes/base.js create mode 100644 node_modules/telegraf/lib/scenes/context.js create mode 100644 node_modules/telegraf/lib/scenes/index.js create mode 100644 node_modules/telegraf/lib/scenes/stage.js create mode 100644 node_modules/telegraf/lib/scenes/wizard/context.js create mode 100644 node_modules/telegraf/lib/scenes/wizard/index.js create mode 100644 node_modules/telegraf/lib/session.js create mode 100644 node_modules/telegraf/lib/telegraf.js create mode 100644 node_modules/telegraf/lib/telegram-types.js create mode 100644 node_modules/telegraf/lib/telegram.js create mode 100644 node_modules/telegraf/lib/types.js create mode 100644 node_modules/telegraf/lib/utils.js create mode 100644 node_modules/telegraf/markup.d.ts create mode 100644 node_modules/telegraf/markup.js create mode 100644 node_modules/telegraf/package.json create mode 100644 node_modules/telegraf/scenes.d.ts create mode 100644 node_modules/telegraf/scenes.js create mode 100644 node_modules/telegraf/session.d.ts create mode 100644 node_modules/telegraf/session.js create mode 100644 node_modules/telegraf/src/button.ts create mode 100644 node_modules/telegraf/src/composer.ts create mode 100644 node_modules/telegraf/src/context.ts create mode 100644 node_modules/telegraf/src/core/helpers/args.ts create mode 100644 node_modules/telegraf/src/core/helpers/check.ts create mode 100644 node_modules/telegraf/src/core/helpers/compact.ts create mode 100644 node_modules/telegraf/src/core/helpers/deunionize.ts create mode 100644 node_modules/telegraf/src/core/helpers/formatting.ts create mode 100644 node_modules/telegraf/src/core/helpers/util.ts create mode 100644 node_modules/telegraf/src/core/network/client.ts create mode 100644 node_modules/telegraf/src/core/network/error.ts create mode 100644 node_modules/telegraf/src/core/network/multipart-stream.ts create mode 100644 node_modules/telegraf/src/core/network/polling.ts create mode 100644 node_modules/telegraf/src/core/network/webhook.ts create mode 100644 node_modules/telegraf/src/core/types/typegram.ts create mode 100644 node_modules/telegraf/src/filters.ts create mode 100644 node_modules/telegraf/src/format.ts create mode 100644 node_modules/telegraf/src/future.ts create mode 100644 node_modules/telegraf/src/index.ts create mode 100644 node_modules/telegraf/src/input.ts create mode 100644 node_modules/telegraf/src/markup.ts create mode 100644 node_modules/telegraf/src/middleware.ts create mode 100644 node_modules/telegraf/src/reactions.ts create mode 100644 node_modules/telegraf/src/router.ts create mode 100644 node_modules/telegraf/src/scenes.ts create mode 100644 node_modules/telegraf/src/scenes/base.ts create mode 100644 node_modules/telegraf/src/scenes/context.ts create mode 100644 node_modules/telegraf/src/scenes/index.ts create mode 100644 node_modules/telegraf/src/scenes/stage.ts create mode 100644 node_modules/telegraf/src/scenes/wizard/context.ts create mode 100644 node_modules/telegraf/src/scenes/wizard/index.ts create mode 100644 node_modules/telegraf/src/session.ts create mode 100644 node_modules/telegraf/src/telegraf.ts create mode 100644 node_modules/telegraf/src/telegram-types.ts create mode 100644 node_modules/telegraf/src/telegram.ts create mode 100644 node_modules/telegraf/src/types.ts create mode 100644 node_modules/telegraf/src/utils.ts create mode 100644 node_modules/telegraf/types.d.ts create mode 100644 node_modules/telegraf/types.js create mode 100644 node_modules/telegraf/typings/button.d.ts create mode 100644 node_modules/telegraf/typings/button.d.ts.map create mode 100644 node_modules/telegraf/typings/composer.d.ts create mode 100644 node_modules/telegraf/typings/composer.d.ts.map create mode 100644 node_modules/telegraf/typings/context.d.ts create mode 100644 node_modules/telegraf/typings/context.d.ts.map create mode 100644 node_modules/telegraf/typings/core/helpers/args.d.ts create mode 100644 node_modules/telegraf/typings/core/helpers/args.d.ts.map create mode 100644 node_modules/telegraf/typings/core/helpers/check.d.ts create mode 100644 node_modules/telegraf/typings/core/helpers/check.d.ts.map create mode 100644 node_modules/telegraf/typings/core/helpers/compact.d.ts create mode 100644 node_modules/telegraf/typings/core/helpers/compact.d.ts.map create mode 100644 node_modules/telegraf/typings/core/helpers/deunionize.d.ts create mode 100644 node_modules/telegraf/typings/core/helpers/deunionize.d.ts.map create mode 100644 node_modules/telegraf/typings/core/helpers/formatting.d.ts create mode 100644 node_modules/telegraf/typings/core/helpers/formatting.d.ts.map create mode 100644 node_modules/telegraf/typings/core/helpers/util.d.ts create mode 100644 node_modules/telegraf/typings/core/helpers/util.d.ts.map create mode 100644 node_modules/telegraf/typings/core/network/client.d.ts create mode 100644 node_modules/telegraf/typings/core/network/client.d.ts.map create mode 100644 node_modules/telegraf/typings/core/network/error.d.ts create mode 100644 node_modules/telegraf/typings/core/network/error.d.ts.map create mode 100644 node_modules/telegraf/typings/core/network/multipart-stream.d.ts create mode 100644 node_modules/telegraf/typings/core/network/multipart-stream.d.ts.map create mode 100644 node_modules/telegraf/typings/core/network/polling.d.ts create mode 100644 node_modules/telegraf/typings/core/network/polling.d.ts.map create mode 100644 node_modules/telegraf/typings/core/network/webhook.d.ts create mode 100644 node_modules/telegraf/typings/core/network/webhook.d.ts.map create mode 100644 node_modules/telegraf/typings/core/types/typegram.d.ts create mode 100644 node_modules/telegraf/typings/core/types/typegram.d.ts.map create mode 100644 node_modules/telegraf/typings/filters.d.ts create mode 100644 node_modules/telegraf/typings/filters.d.ts.map create mode 100644 node_modules/telegraf/typings/format.d.ts create mode 100644 node_modules/telegraf/typings/format.d.ts.map create mode 100644 node_modules/telegraf/typings/future.d.ts create mode 100644 node_modules/telegraf/typings/future.d.ts.map create mode 100644 node_modules/telegraf/typings/index.d.ts create mode 100644 node_modules/telegraf/typings/index.d.ts.map create mode 100644 node_modules/telegraf/typings/input.d.ts create mode 100644 node_modules/telegraf/typings/input.d.ts.map create mode 100644 node_modules/telegraf/typings/markup.d.ts create mode 100644 node_modules/telegraf/typings/markup.d.ts.map create mode 100644 node_modules/telegraf/typings/middleware.d.ts create mode 100644 node_modules/telegraf/typings/middleware.d.ts.map create mode 100644 node_modules/telegraf/typings/reactions.d.ts create mode 100644 node_modules/telegraf/typings/reactions.d.ts.map create mode 100644 node_modules/telegraf/typings/router.d.ts create mode 100644 node_modules/telegraf/typings/router.d.ts.map create mode 100644 node_modules/telegraf/typings/scenes.d.ts create mode 100644 node_modules/telegraf/typings/scenes.d.ts.map create mode 100644 node_modules/telegraf/typings/scenes/base.d.ts create mode 100644 node_modules/telegraf/typings/scenes/base.d.ts.map create mode 100644 node_modules/telegraf/typings/scenes/context.d.ts create mode 100644 node_modules/telegraf/typings/scenes/context.d.ts.map create mode 100644 node_modules/telegraf/typings/scenes/index.d.ts create mode 100644 node_modules/telegraf/typings/scenes/index.d.ts.map create mode 100644 node_modules/telegraf/typings/scenes/stage.d.ts create mode 100644 node_modules/telegraf/typings/scenes/stage.d.ts.map create mode 100644 node_modules/telegraf/typings/scenes/wizard/context.d.ts create mode 100644 node_modules/telegraf/typings/scenes/wizard/context.d.ts.map create mode 100644 node_modules/telegraf/typings/scenes/wizard/index.d.ts create mode 100644 node_modules/telegraf/typings/scenes/wizard/index.d.ts.map create mode 100644 node_modules/telegraf/typings/session.d.ts create mode 100644 node_modules/telegraf/typings/session.d.ts.map create mode 100644 node_modules/telegraf/typings/telegraf.d.ts create mode 100644 node_modules/telegraf/typings/telegraf.d.ts.map create mode 100644 node_modules/telegraf/typings/telegram-types.d.ts create mode 100644 node_modules/telegraf/typings/telegram-types.d.ts.map create mode 100644 node_modules/telegraf/typings/telegram.d.ts create mode 100644 node_modules/telegraf/typings/telegram.d.ts.map create mode 100644 node_modules/telegraf/typings/types.d.ts create mode 100644 node_modules/telegraf/typings/types.d.ts.map create mode 100644 node_modules/telegraf/typings/utils.d.ts create mode 100644 node_modules/telegraf/typings/utils.d.ts.map create mode 100644 node_modules/telegraf/utils.d.ts create mode 100644 node_modules/telegraf/utils.js create mode 100644 node_modules/tr46/.npmignore create mode 100644 node_modules/tr46/index.js create mode 100644 node_modules/tr46/lib/.gitkeep create mode 100644 node_modules/tr46/lib/mappingTable.json create mode 100644 node_modules/tr46/package.json create mode 100644 node_modules/webidl-conversions/LICENSE.md create mode 100644 node_modules/webidl-conversions/README.md create mode 100644 node_modules/webidl-conversions/lib/index.js create mode 100644 node_modules/webidl-conversions/package.json create mode 100644 node_modules/whatwg-url/LICENSE.txt create mode 100644 node_modules/whatwg-url/README.md create mode 100644 node_modules/whatwg-url/lib/URL-impl.js create mode 100644 node_modules/whatwg-url/lib/URL.js create mode 100644 node_modules/whatwg-url/lib/public-api.js create mode 100644 node_modules/whatwg-url/lib/url-state-machine.js create mode 100644 node_modules/whatwg-url/lib/utils.js create mode 100644 node_modules/whatwg-url/package.json create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 tg_filebrowser_bot.js diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..0561535 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,96 @@ +pipeline { + agent any + parameters { + string(name: 'ALLOWED_TELEGRAM_IDS', defaultValue: '792742394', description: '') + } + environment { + BOT_TOKEN = credentials('tg-bot-token') + BASE_DIR = '/srv/files' + BOT_HOST = 'storage.fymio.us' + REMOTE_USER = 'deploy' + SSH_CRED = 'bot-ssh' + REMOTE_DIR = '/srv/tg-bot' + REPO_URL = 'https://git.fymio.us/nik/fymious_tg_bot' + BRANCH = 'main' + } + stages { + stage('Checkout') { + steps { checkout scm } + } + stage('TrustHost') { + steps { + sh ''' + mkdir -p ~/.ssh + ssh-keyscan -H ${BOT_HOST} >> ~/.ssh/known_hosts + ''' + } + } + stage('Ship & Restart') { + steps { + sshagent(credentials: [env.SSH_CRED]) { + sh ''' + ssh -o StrictHostKeyChecking=no ${REMOTE_USER}@${BOT_HOST} " + export REMOTE_DIR='${REMOTE_DIR}' + export REPO_URL='${REPO_URL}' + export BRANCH='${BRANCH}' + export REMOTE_USER='${REMOTE_USER}' + export BOT_TOKEN='${BOT_TOKEN}' + export BASE_DIR='${BASE_DIR}' + export ALLOWED_TELEGRAM_IDS='${ALLOWED_TELEGRAM_IDS}' + + set -euo pipefail + DIR=\\$REMOTE_DIR + REPO=\\$REPO_URL + BR=\\$BRANCH + + # Create directory without sudo first + mkdir -p \\$DIR || echo 'Directory might already exist' + + # Clone or update repository + if [ -d \\\"\\$DIR/.git\\\" ]; then + cd \\$DIR + git fetch origin \\$BR + git reset --hard origin/\\$BR + else + if [ -z \\\"\\\$(ls -A \\\"\\$DIR\\\" 2>/dev/null || true)\\\" ]; then + git clone --depth 1 -b \\$BR \\$REPO \\$DIR + else + rm -rf \\$DIR/* + git clone --depth 1 -b \\$BR \\$REPO \\$DIR + fi + fi + + # Create .env file + cd \\$DIR + echo \\\"BOT_TOKEN=\\$BOT_TOKEN\\\" > .env + echo \\\"BASE_DIR=\\$BASE_DIR\\\" >> .env + echo \\\"ALLOWED_TELEGRAM_IDS=\\$ALLOWED_TELEGRAM_IDS\\\" >> .env + + # Install npm dependencies if needed + if [ -f package.json ]; then + if command -v npm >/dev/null 2>&1; then + npm ci || npm install + fi + fi + + # Try to restart service with sudo (might need NOPASSWD configured) + echo 'Attempting to restart service...' + sudo systemctl restart tg_filebrowser_bot || echo 'Service restart failed - might need manual restart' + + # Show service status for debugging + sudo systemctl status tg_filebrowser_bot || systemctl --user status tg_filebrowser_bot || echo 'Could not get service status' + " + ''' + } + } + } + stage('LogsIfFailed') { + when { expression { currentBuild.currentResult == 'FAILURE' } } + steps { + sshagent(credentials: [env.SSH_CRED]) { + sh 'ssh ${REMOTE_USER}@${BOT_HOST} "journalctl -u tg_filebrowser_bot -n 200 --no-pager || journalctl --user -u tg_filebrowser_bot -n 200 --no-pager || echo \\"Could not get logs\\""' + } + } + } + } +} diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..3cca1ba --- /dev/null +++ b/deploy.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail +APP_DIR="/srv/tg-bot" +mkdir -p "$APP_DIR" +rsync -a --delete --exclude ".git" ./ "$APP_DIR"/ +cd "$APP_DIR" +if [ -f package.json ]; then + if command -v npm >/dev/null 2>&1; then + npm ci || npm install + fi +fi +systemctl restart tg_filebrowser_bot + diff --git a/node_modules/.bin/telegraf b/node_modules/.bin/telegraf new file mode 120000 index 0000000..5bbffed --- /dev/null +++ b/node_modules/.bin/telegraf @@ -0,0 +1 @@ +../telegraf/lib/cli.mjs \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..f5e6a70 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,192 @@ +{ + "name": "tg-bot", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@telegraf/types": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@telegraf/types/-/types-7.1.0.tgz", + "integrity": "sha512-kGevOIbpMcIlCDeorKGpwZmdH7kHbqlk/Yj6dEpJMKEQw5lk0KVQY0OLXaCswy8GqlIVLd5625OB+rAntP9xVw==", + "license": "MIT" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "license": "MIT", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "license": "MIT" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/p-timeout": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", + "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/safe-compare": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz", + "integrity": "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==", + "license": "MIT", + "dependencies": { + "buffer-alloc": "^1.2.0" + } + }, + "node_modules/sandwich-stream": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz", + "integrity": "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ==", + "license": "Apache-2.0", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/telegraf": { + "version": "4.16.3", + "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-4.16.3.tgz", + "integrity": "sha512-yjEu2NwkHlXu0OARWoNhJlIjX09dRktiMQFsM678BAH/PEPVwctzL67+tvXqLCRQQvm3SDtki2saGO9hLlz68w==", + "license": "MIT", + "dependencies": { + "@telegraf/types": "^7.1.0", + "abort-controller": "^3.0.0", + "debug": "^4.3.4", + "mri": "^1.2.0", + "node-fetch": "^2.7.0", + "p-timeout": "^4.1.0", + "safe-compare": "^1.1.4", + "sandwich-stream": "^2.0.2" + }, + "bin": { + "telegraf": "lib/cli.mjs" + }, + "engines": { + "node": "^12.20.0 || >=14.13.1" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } +} diff --git a/node_modules/@telegraf/types/LICENSE b/node_modules/@telegraf/types/LICENSE new file mode 100644 index 0000000..e1a0503 --- /dev/null +++ b/node_modules/@telegraf/types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) KnorpelSenf & Telegraf contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@telegraf/types/README.md b/node_modules/@telegraf/types/README.md new file mode 100644 index 0000000..197fda8 --- /dev/null +++ b/node_modules/@telegraf/types/README.md @@ -0,0 +1,113 @@ +# Types for the Telegram Bot API [![Deno shield](https://img.shields.io/static/v1?label=Built%20for&message=Deno&style=flat-square&logo=deno&labelColor=000&color=fff)](https://deno.land/x/telegraf_types) + +[![Bot API Version](https://img.shields.io/badge/Bot%20API-v6.9-f36caf.svg?style=flat-square&logo=Telegram&labelColor=white&color=blue)](https://core.telegram.org/bots/api) [![NPM version](https://img.shields.io/npm/v/@telegraf/types?style=flat-square&logo=npm&labelColor=fff&color=c53635)](https://npmjs.com/package/@telegraf/types) + +This project is a fork of [@KnorpelSenf/typegram](https://github.com/KnorpelSenf/typegram), specialised for Telegraf. Typegram is legacy, and now backported from [@grammyjs/types](https://github.com/grammyjs/types). + +This fork keeps Telegram Bot API types updated for Telegraf. This project provides TypeScript types for the entire [Telegram Bot API](https://core.telegram.org/bots/api). + +It contains zero bytes of executable code. + +## Installation + +```bash +npm install --save-dev @telegraf/types +``` + +## Available Types + +Generally, this package just exposes a huge load of `interface`s that correspond to the **types** used throughout the Telegram Bot API. + +Note that the API specification sometimes only has one name for multiple variants of a type, e.g. there are a number of different `Update`s you can receive, but they're all just called `Update`. +This package represents such types as large unions of all possible options of what an `Update` could be, such that type narrowing can work as expected on your side. +If you need to access the individual variants of an `Update`, refer to `Update.MessageUpdate` and its siblings. + +In fact, this pattern is used for various types, namely: + +- `Update` +- `Message` +- `CallbackQuery` +- `Chat` +- `ChatFromGetChat` +- `InlineKeyboardButton` +- `KeyboardButton` +- `MessageEntity` +- `Location` + +(Naturally, when the API specification is actually modelling types to be unions (e.g. `InlineQueryResult`), this is reflected here as a union type, too.) + +## Using API Response objects + +The Telegram Bot API does not return just the requested data in the body of the response objects. + +Instead, they are wrapped inside an object that has an `ok: boolean` status flag, indicating success or failure of the preceding API request. +This outer object is modelled in `@telegraf/types` by the `ApiResponse` type. + +## Customizing `InputFile` and accessing API methods + +The Telegram Bot API lets bots send files in [three different ways](https://core.telegram.org/bots/api#sending-files). +Two of those ways are by specifying a `string`—either a `file_id` or a URL. +The third option, however, is by uploading files to the server using multipart/form-data. + +The first two means to send a file are already covered by the type annotations across the library. +In all places where a `file_id` or a URL is permitted, the corresponding property allows a `string`. + +We will now look at the type declarations that are relevant for uploading files directly. +Depending on the code you're using the types for, you may want to support different ways to specify the file to be uploaded. +As an example, you may want to be able to make calls to `sendDocument` with an object that conforms to `{ path: string }` in order to specify the location of a local file. +(Your code is then assumed to able to translate calls to `sendDocument` and the like to multipart/form-data uploads when supplied with an object alike `{ path: '/tmp/file.txt' }` in the `document` property of the argument object.) + +This library cannot automatically know what objects you want to support as `InputFile`s. + +However, you can specify your own version of what an `InputFile` is throughout all affected methods and interfaces. + +For instance, let's stick with our example and say that you want to support `InputFile`s of the following type. + +```ts +interface MyInputFile { + path: string; +} +``` + +You can then customize the types to fit your needs by passing your custom `InputFile` to the `ApiMethods` type. + +```ts +import * as Telegram from "@telegraf/types"; + +type API = Telegram.ApiMethods; +``` + +You can now access all types that must respect `MyInputFile` through the `API` type: + +```ts +// The utility types `Opts` and `Ret`: +type Opts = Telegram.Opts[M]; +type Ret = Telegram.Ret[M]; +``` + +Each method takes just a single argument with a structure that corresponds to the object expected by Telegram. +If you need to directly access that type, consider using `Opts` where `M` is the method name (e.g. `Opts<'getMe'>`). + +Each method returns the object that is specified by Telegram. +If you directly need to access the return type of a method, consider using `Ret` where `M` is the method name (e.g. `Opts<'getMe'>`). + +```ts +// The adjusted `InputMedia*` types: +type InputMedia = Telegram.InputMedia; +type InputMediaPhoto = Telegram.InputMediaPhoto; +type InputMediaVideo = Telegram.InputMediaVideo; +type InputMediaAnimation = Telegram.InputMediaAnimation; +type InputMediaAudio = Telegram.InputMediaAudio; +type InputMediaDocument = Telegram.InputMediaDocument; +``` + +Note that interfaces other than the ones mentioned above are unaffected by the customization through `MyInputFile`. +They can simply continue to be imported directly. + +## Development + +This project is written for Deno and built for Node. Running `npm prepare` runs the deno2node script to build for Node. + +## Where do the types come from + +They're handwritten. Typegram was started by [@KnorpelSenf](https://github.com/KnorpelSenf), who eventually used it as a starting point for [the grammY types package](https://github.com/grammyjs/types). `@telegraf/types` is based on both packages, and regularly syncs with them and the Bot API. diff --git a/node_modules/@telegraf/types/api.d.ts b/node_modules/@telegraf/types/api.d.ts new file mode 100644 index 0000000..ea7c9f7 --- /dev/null +++ b/node_modules/@telegraf/types/api.d.ts @@ -0,0 +1,22 @@ +export interface ApiError { + ok: false; + error_code: number; + description: string; + parameters?: ResponseParameters; +} +export interface ApiSuccess { + ok: true; + result: T; +} +/** The response contains an object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals true, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error. + +All methods in the Bot API are case-insensitive. +All queries must be made using UTF-8. */ +export type ApiResponse = ApiError | ApiSuccess; +/** Describes why a request was unsuccessful. */ +export interface ResponseParameters { + /** The group has been migrated to a supergroup with the specified identifier. */ + migrate_to_chat_id?: number; + /** In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */ + retry_after?: number; +} diff --git a/node_modules/@telegraf/types/default.d.ts b/node_modules/@telegraf/types/default.d.ts new file mode 100644 index 0000000..5d43a9b --- /dev/null +++ b/node_modules/@telegraf/types/default.d.ts @@ -0,0 +1,40 @@ +import { Typegram } from "./proxied"; + +/** This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser. */ +export type InputFile = never; + +type DefaultTypegram = Typegram; + +/** Wrapper type to bundle all methods of the Telegram API */ +export type Telegram = DefaultTypegram["Telegram"]; + +/** Utility type providing the argument type for the given method name or `{}` if the method does not take any parameters */ +export type Opts = + DefaultTypegram["Opts"][M]; +export type Ret = + DefaultTypegram["Ret"][M]; + +/** Utility type providing a promisified version of Telegram */ +export type TelegramP = DefaultTypegram["TelegramP"]; +/** Utility type providing a version Telegram where all methods return ApiResponse objects instead of raw data */ +export type TelegramR = DefaultTypegram["TelegramR"]; +/** Utility type providing a version Telegram where all methods return Promises of ApiResponse objects, combination of TelegramP and TelegramR */ +export type TelegramPR = DefaultTypegram["TelegramPR"]; + +/** This object represents the content of a media message to be sent. It should be one of +- InputMediaAnimation +- InputMediaDocument +- InputMediaAudio +- InputMediaPhoto +- InputMediaVideo */ +export type InputMedia = DefaultTypegram["InputMedia"]; +/** Represents a photo to be sent. */ +export type InputMediaPhoto = DefaultTypegram["InputMediaPhoto"]; +/** Represents a video to be sent. */ +export type InputMediaVideo = DefaultTypegram["InputMediaVideo"]; +/** Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. */ +export type InputMediaAnimation = DefaultTypegram["InputMediaAnimation"]; +/** Represents an audio file to be treated as music to be sent. */ +export type InputMediaAudio = DefaultTypegram["InputMediaAudio"]; +/** Represents a general file to be sent. */ +export type InputMediaDocument = DefaultTypegram["InputMediaDocument"]; diff --git a/node_modules/@telegraf/types/index.d.ts b/node_modules/@telegraf/types/index.d.ts new file mode 100644 index 0000000..6635048 --- /dev/null +++ b/node_modules/@telegraf/types/index.d.ts @@ -0,0 +1,10 @@ +export * from "./api.js"; +export * from "./inline.js"; +export * from "./manage.js"; +export * from "./markup.js"; +export * from "./message.js"; +export * from "./methods.js"; +export * from "./passport.js"; +export * from "./payment.js"; +export * from "./settings.js"; +export * from "./update.js"; diff --git a/node_modules/@telegraf/types/inline.d.ts b/node_modules/@telegraf/types/inline.d.ts new file mode 100644 index 0000000..b0e3166 --- /dev/null +++ b/node_modules/@telegraf/types/inline.d.ts @@ -0,0 +1,697 @@ +import type { Chat, User } from "./manage.js"; +import type { InlineKeyboardMarkup, WebAppInfo } from "./markup.js"; +import type { LinkPreviewOptions, Location, MessageEntity, ParseMode } from "./message.js"; +import type { LabeledPrice } from "./payment.js"; +/** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */ +export interface InlineQuery { + /** Unique identifier for this query */ + id: string; + /** Sender */ + from: User; + /** Text of the query (up to 256 characters) */ + query: string; + /** Offset of the results to be returned, can be controlled by the bot */ + offset: string; + /** Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat */ + chat_type?: "sender" | Chat["type"]; + /** Sender location, only for bots that request user location */ + location?: Location; +} +/** This object represents one result of an inline query. Telegram clients currently support results of the following 20 types: +- InlineQueryResultCachedAudio +- InlineQueryResultCachedDocument +- InlineQueryResultCachedGif +- InlineQueryResultCachedMpeg4Gif +- InlineQueryResultCachedPhoto +- InlineQueryResultCachedSticker +- InlineQueryResultCachedVideo +- InlineQueryResultCachedVoice +- InlineQueryResultArticle +- InlineQueryResultAudio +- InlineQueryResultContact +- InlineQueryResultGame +- InlineQueryResultDocument +- InlineQueryResultGif +- InlineQueryResultLocation +- InlineQueryResultMpeg4Gif +- InlineQueryResultPhoto +- InlineQueryResultVenue +- InlineQueryResultVideo +- InlineQueryResultVoice + +Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public. */ +export type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice; +/** Represents a link to an article or web page. */ +export interface InlineQueryResultArticle { + /** Type of the result, must be article */ + type: "article"; + /** Unique identifier for this result, 1-64 Bytes */ + id: string; + /** Title of the result */ + title: string; + /** Content of the message to be sent */ + input_message_content: InputMessageContent; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** URL of the result */ + url?: string; + /** Pass True if you don't want the URL to be shown in the message */ + hide_url?: boolean; + /** Short description of the result */ + description?: string; + /** Url of the thumbnail for the result */ + thumbnail_url?: string; + /** Thumbnail width */ + thumbnail_width?: number; + /** Thumbnail height */ + thumbnail_height?: number; +} +/** Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */ +export interface InlineQueryResultPhoto { + /** Type of the result, must be photo */ + type: "photo"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB */ + photo_url: string; + /** URL of the thumbnail for the photo */ + thumbnail_url: string; + /** Width of the photo */ + photo_width?: number; + /** Height of the photo */ + photo_height?: number; + /** Title for the result */ + title?: string; + /** Short description of the result */ + description?: string; + /** Caption of the photo to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the photo caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the photo */ + input_message_content?: InputMessageContent; +} +/** Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */ +export interface InlineQueryResultGif { + /** Type of the result, must be gif */ + type: "gif"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid URL for the GIF file. File size must not exceed 1MB */ + gif_url: string; + /** Width of the GIF */ + gif_width?: number; + /** Height of the GIF */ + gif_height?: number; + /** Duration of the GIF in seconds */ + gif_duration?: number; + /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */ + thumbnail_url: string; + /** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */ + thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4"; + /** Title for the result */ + title?: string; + /** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the GIF animation */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */ +export interface InlineQueryResultMpeg4Gif { + /** Type of the result, must be mpeg4_gif */ + type: "mpeg4_gif"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid URL for the MPEG4 file. File size must not exceed 1MB */ + mpeg4_url: string; + /** Video width */ + mpeg4_width?: number; + /** Video height */ + mpeg4_height?: number; + /** Video duration in seconds */ + mpeg4_duration?: number; + /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */ + thumbnail_url: string; + /** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */ + thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4"; + /** Title for the result */ + title?: string; + /** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the video animation */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. + +> If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. */ +export interface InlineQueryResultVideo { + /** Type of the result, must be video */ + type: "video"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid URL for the embedded video player or video file */ + video_url: string; + /** MIME type of the content of the video URL, “text/html” or “video/mp4” */ + mime_type: "text/html" | "video/mp4"; + /** URL of the thumbnail (JPEG only) for the video */ + thumbnail_url: string; + /** Title for the result */ + title: string; + /** Caption of the video to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the video caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Video width */ + video_width?: number; + /** Video height */ + video_height?: number; + /** Video duration in seconds */ + video_duration?: number; + /** Short description of the result */ + description?: string; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). */ + input_message_content?: InputMessageContent; +} +/** Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultAudio { + /** Type of the result, must be audio */ + type: "audio"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid URL for the audio file */ + audio_url: string; + /** Title */ + title: string; + /** Caption, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the audio caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Performer */ + performer?: string; + /** Audio duration in seconds */ + audio_duration?: number; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the audio */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultVoice { + /** Type of the result, must be voice */ + type: "voice"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid URL for the voice recording */ + voice_url: string; + /** Recording title */ + title: string; + /** Caption, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the voice message caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Recording duration in seconds */ + voice_duration?: number; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the voice recording */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultDocument { + /** Type of the result, must be document */ + type: "document"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** Title for the result */ + title: string; + /** Caption of the document to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the document caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** A valid URL for the file */ + document_url: string; + /** MIME type of the content of the file, either “application/pdf” or “application/zip” */ + mime_type: "application/pdf" | "application/zip"; + /** Short description of the result */ + description?: string; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the file */ + input_message_content?: InputMessageContent; + /** URL of the thumbnail (JPEG only) for the file */ + thumbnail_url?: string; + /** Thumbnail width */ + thumbnail_width?: number; + /** Thumbnail height */ + thumbnail_height?: number; +} +/** Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultLocation { + /** Type of the result, must be location */ + type: "location"; + /** Unique identifier for this result, 1-64 Bytes */ + id: string; + /** Location latitude in degrees */ + latitude: number; + /** Location longitude in degrees */ + longitude: number; + /** Location title */ + title: string; + /** The radius of uncertainty for the location, measured in meters; 0-1500 */ + horizontal_accuracy?: number; + /** Period in seconds for which the location can be updated, should be between 60 and 86400. */ + live_period?: number; + /** For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */ + heading?: number; + /** For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */ + proximity_alert_radius?: number; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the location */ + input_message_content?: InputMessageContent; + /** Url of the thumbnail for the result */ + thumbnail_url?: string; + /** Thumbnail width */ + thumbnail_width?: number; + /** Thumbnail height */ + thumbnail_height?: number; +} +/** Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultVenue { + /** Type of the result, must be venue */ + type: "venue"; + /** Unique identifier for this result, 1-64 Bytes */ + id: string; + /** Latitude of the venue location in degrees */ + latitude: number; + /** Longitude of the venue location in degrees */ + longitude: number; + /** Title of the venue */ + title: string; + /** Address of the venue */ + address: string; + /** Foursquare identifier of the venue if known */ + foursquare_id?: string; + /** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ + foursquare_type?: string; + /** Google Places identifier of the venue */ + google_place_id?: string; + /** Google Places type of the venue. (See supported types.) */ + google_place_type?: string; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the venue */ + input_message_content?: InputMessageContent; + /** Url of the thumbnail for the result */ + thumbnail_url?: string; + /** Thumbnail width */ + thumbnail_width?: number; + /** Thumbnail height */ + thumbnail_height?: number; +} +/** Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultContact { + /** Type of the result, must be contact */ + type: "contact"; + /** Unique identifier for this result, 1-64 Bytes */ + id: string; + /** Contact's phone number */ + phone_number: string; + /** Contact's first name */ + first_name: string; + /** Contact's last name */ + last_name?: string; + /** Additional data about the contact in the form of a vCard, 0-2048 bytes */ + vcard?: string; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the contact */ + input_message_content?: InputMessageContent; + /** Url of the thumbnail for the result */ + thumbnail_url?: string; + /** Thumbnail width */ + thumbnail_width?: number; + /** Thumbnail height */ + thumbnail_height?: number; +} +/** Represents a Game. + +Note: This will only work in Telegram versions released after October 1, 2016. Older clients will not display any inline results if a game result is among them. */ +export interface InlineQueryResultGame { + /** Type of the result, must be game */ + type: "game"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** Short name of the game */ + game_short_name: string; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; +} +/** Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */ +export interface InlineQueryResultCachedPhoto { + /** Type of the result, must be photo */ + type: "photo"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid file identifier of the photo */ + photo_file_id: string; + /** Title for the result */ + title?: string; + /** Short description of the result */ + description?: string; + /** Caption of the photo to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the photo caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the photo */ + input_message_content?: InputMessageContent; +} +/** Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. */ +export interface InlineQueryResultCachedGif { + /** Type of the result, must be gif */ + type: "gif"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid file identifier for the GIF file */ + gif_file_id: string; + /** Title for the result */ + title?: string; + /** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the GIF animation */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */ +export interface InlineQueryResultCachedMpeg4Gif { + /** Type of the result, must be mpeg4_gif */ + type: "mpeg4_gif"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid file identifier for the MPEG4 file */ + mpeg4_file_id: string; + /** Title for the result */ + title?: string; + /** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the video animation */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker. + +Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them. */ +export interface InlineQueryResultCachedSticker { + /** Type of the result, must be sticker */ + type: "sticker"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid file identifier of the sticker */ + sticker_file_id: string; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the sticker */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultCachedDocument { + /** Type of the result, must be document */ + type: "document"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** Title for the result */ + title: string; + /** A valid file identifier for the file */ + document_file_id: string; + /** Short description of the result */ + description?: string; + /** Caption of the document to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the document caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the file */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. */ +export interface InlineQueryResultCachedVideo { + /** Type of the result, must be video */ + type: "video"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid file identifier for the video file */ + video_file_id: string; + /** Title for the result */ + title: string; + /** Short description of the result */ + description?: string; + /** Caption of the video to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the video caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the video */ + input_message_content?: InputMessageContent; +} +/** Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultCachedVoice { + /** Type of the result, must be voice */ + type: "voice"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid file identifier for the voice message */ + voice_file_id: string; + /** Voice message title */ + title: string; + /** Caption, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the voice message caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the voice message */ + input_message_content?: InputMessageContent; +} +/** Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. + +Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */ +export interface InlineQueryResultCachedAudio { + /** Type of the result, must be audio */ + type: "audio"; + /** Unique identifier for this result, 1-64 bytes */ + id: string; + /** A valid file identifier for the audio file */ + audio_file_id: string; + /** Caption, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the audio caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Inline keyboard attached to the message */ + reply_markup?: InlineKeyboardMarkup; + /** Content of the message to be sent instead of the audio */ + input_message_content?: InputMessageContent; +} +/** This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types: + +- InputTextMessageContent +- InputLocationMessageContent +- InputVenueMessageContent +- InputContactMessageContent +- InputInvoiceMessageContent */ +export type InputMessageContent = InputTextMessageContent | InputLocationMessageContent | InputVenueMessageContent | InputContactMessageContent | InputInvoiceMessageContent; +/** Represents the content of a text message to be sent as the result of an inline query. */ +export interface InputTextMessageContent { + /** Text of the message to be sent, 1-4096 characters */ + message_text: string; + /** Mode for parsing entities in the message text. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in message text, which can be specified instead of parse_mode */ + entities?: MessageEntity[]; + /** Options used for link preview generation for the original message, if it is a text message */ + link_preview_options?: LinkPreviewOptions; +} +/** Represents the content of a location message to be sent as the result of an inline query. */ +export interface InputLocationMessageContent { + /** Latitude of the location in degrees */ + latitude: number; + /** Longitude of the location in degrees */ + longitude: number; + /** The radius of uncertainty for the location, measured in meters; 0-1500 */ + horizontal_accuracy?: number; + /** Period in seconds for which the location can be updated, should be between 60 and 86400. */ + live_period?: number; + /** For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */ + heading?: number; + /** For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */ + proximity_alert_radius?: number; +} +/** Represents the content of a venue message to be sent as the result of an inline query. */ +export interface InputVenueMessageContent { + /** Latitude of the venue in degrees */ + latitude: number; + /** Longitude of the venue in degrees */ + longitude: number; + /** Name of the venue */ + title: string; + /** Address of the venue */ + address: string; + /** Foursquare identifier of the venue, if known */ + foursquare_id?: string; + /** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ + foursquare_type?: string; + /** Google Places identifier of the venue */ + google_place_id?: string; + /** Google Places type of the venue. (See supported types.) */ + google_place_type?: string; +} +/** Represents the content of a contact message to be sent as the result of an inline query. */ +export interface InputContactMessageContent { + /** Contact's phone number */ + phone_number: string; + /** Contact's first name */ + first_name: string; + /** Contact's last name */ + last_name?: string; + /** Additional data about the contact in the form of a vCard, 0-2048 bytes */ + vcard?: string; +} +/** Represents the content of an invoice message to be sent as the result of an inline query. */ +export interface InputInvoiceMessageContent { + /** Product name, 1-32 characters */ + title: string; + /** Product description, 1-255 characters */ + description: string; + /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */ + payload: string; + /** Payment provider token, obtained via BotFather */ + provider_token: string; + /** Three-letter ISO 4217 currency code, see more on currencies */ + currency: string; + /** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */ + prices: LabeledPrice[]; + /** The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */ + max_tip_amount?: number; + /** An array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */ + suggested_tip_amounts?: number[]; + /** Data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. */ + provider_data?: string; + /** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. */ + photo_url?: string; + /** Photo size in bytes */ + photo_size?: number; + /** Photo width */ + photo_width?: number; + /** Photo height */ + photo_height?: number; + /** Pass True if you require the user's full name to complete the order */ + need_name?: boolean; + /** Pass True if you require the user's phone number to complete the order */ + need_phone_number?: boolean; + /** Pass True if you require the user's email address to complete the order */ + need_email?: boolean; + /** Pass True if you require the user's shipping address to complete the order */ + need_shipping_address?: boolean; + /** Pass True if the user's phone number should be sent to provider */ + send_phone_number_to_provider?: boolean; + /** Pass True if the user's email address should be sent to provider */ + send_email_to_provider?: boolean; + /** Pass True if the final price depends on the shipping method */ + is_flexible?: boolean; +} +/** Represents a result of an inline query that was chosen by the user and sent to their chat partner. + +Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates. */ +export interface ChosenInlineResult { + /** The unique identifier for the result that was chosen */ + result_id: string; + /** The user that chose the result */ + from: User; + /** Sender location, only for bots that require user location */ + location?: Location; + /** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. */ + inline_message_id?: string; + /** The query that was used to obtain the result */ + query: string; +} +export interface AbstractInlineQueryResultsButton { + /** Label text on the button */ + text: string; +} +export interface InlineQueryResultsWebAppButton extends AbstractInlineQueryResultsButton { + /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App. */ + web_app: WebAppInfo; +} +export interface InlineQueryResultsStartButton extends AbstractInlineQueryResultsButton { + /** Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only `A-Z`, `a-z`, `0-9`, `_` and `-` are allowed. */ + start_parameter: string; +} +/** This object represents a button to be shown above inline query results. + +Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities. */ +export type InlineQueryResultsButton = InlineQueryResultsWebAppButton | InlineQueryResultsStartButton; diff --git a/node_modules/@telegraf/types/manage.d.ts b/node_modules/@telegraf/types/manage.d.ts new file mode 100644 index 0000000..3118eb6 --- /dev/null +++ b/node_modules/@telegraf/types/manage.d.ts @@ -0,0 +1,594 @@ +import type { Location, Message, PhotoSize } from "./message.js"; +/** Describes the current status of a webhook. */ +export interface WebhookInfo { + /** Webhook URL, may be empty if webhook is not set up */ + url?: string; + /** True, if a custom certificate was provided for webhook certificate checks */ + has_custom_certificate: boolean; + /** Number of updates awaiting delivery */ + pending_update_count: number; + /** Currently used webhook IP address */ + ip_address?: string; + /** Unix time for the most recent error that happened when trying to deliver an update via webhook */ + last_error_date?: number; + /** Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */ + last_error_message?: string; + /** Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */ + last_synchronization_error_date?: number; + /** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */ + max_connections?: number; + /** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */ + allowed_updates?: string[]; +} +/** This object represents a Telegram user or bot. */ +export interface User { + /** Unique identifier for this user or bot. */ + id: number; + /** True, if this user is a bot */ + is_bot: boolean; + /** User's or bot's first name */ + first_name: string; + /** User's or bot's last name */ + last_name?: string; + /** User's or bot's username */ + username?: string; + /** IETF language tag of the user's language */ + language_code?: string; + /** True, if this user is a Telegram Premium user */ + is_premium?: true; + /** True, if this user added the bot to the attachment menu */ + added_to_attachment_menu?: true; +} +/** This object represents a Telegram user or bot that was returned by `getMe`. */ +export interface UserFromGetMe extends User { + is_bot: true; + username: string; + /** True, if the bot can be invited to groups. Returned only in getMe. */ + can_join_groups: boolean; + /** True, if privacy mode is disabled for the bot. Returned only in getMe. */ + can_read_all_group_messages: boolean; + /** True, if the bot supports inline queries. Returned only in getMe. */ + supports_inline_queries: boolean; +} +export declare namespace Chat { + /** Internal type holding properties that all kinds of chats share. */ + interface AbstractChat { + /** Unique identifier for this chat. */ + id: number; + /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */ + type: string; + } + /** Internal type holding properties that those chats with user names share. */ + interface UserNameChat { + /** Username, for private chats, supergroups and channels if available */ + username?: string; + } + /** Internal type holding properties that those chats with titles share. */ + interface TitleChat { + /** Title, for supergroups, channels and group chats */ + title: string; + } + /** Internal type representing private chats. */ + interface PrivateChat extends AbstractChat, UserNameChat { + type: "private"; + /** First name of the other party in a private chat */ + first_name: string; + /** Last name of the other party in a private chat */ + last_name?: string; + } + /** Internal type representing group chats. */ + interface GroupChat extends AbstractChat, TitleChat { + type: "group"; + } + /** Internal type representing super group chats. */ + interface SupergroupChat extends AbstractChat, UserNameChat, TitleChat { + type: "supergroup"; + /** True, if the supergroup chat is a forum (has topics enabled) */ + is_forum?: true; + } + /** Internal type representing channel chats. */ + interface ChannelChat extends AbstractChat, UserNameChat, TitleChat { + type: "channel"; + } + /** Internal type holding properties that those chats returned from `getChat` share. */ + interface GetChat { + /** Chat photo. Returned only in getChat. */ + photo?: ChatPhoto; + /** The most recent pinned message (by sending date). Returned only in getChat. */ + pinned_message?: Message; + /** The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. */ + message_auto_delete_time?: number; + /** True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. */ + has_protected_content?: true; + } + /** Internal type holding properties that private, supergroup, and channel chats returned from `getChat` share. */ + interface NonGroupGetChat extends GetChat { + /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. */ + active_usernames?: string[]; + } + /** Internal type holding properties that group, supergroup, and channel chats returned from `getChat` share. */ + interface NonPrivateGetChat extends GetChat { + /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat. */ + available_reactions?: ReactionType[]; + /** Description, for groups, supergroups and channel chats. Returned only in getChat. */ + description?: string; + /** Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */ + invite_link?: string; + } + /** Internal type holding properties that group and supergroup chats returned from `getChat` share. */ + interface AnyGroupGetChat extends NonPrivateGetChat { + /** Default chat member permissions, for groups and supergroups. Returned only in getChat. */ + permissions?: ChatPermissions; + /** True, if the bot can change the group sticker set. Returned only in getChat. */ + can_set_sticker_set?: true; + } + /** Internal type holding properties that private and channel chats returned from `getChat` share. */ + interface PrivateAndChannelGetChat { + /** Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. */ + accent_color_id: number; + /** Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat. */ + background_custom_emoji_id?: string; + /** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */ + emoji_status_custom_emoji_id?: string; + /** Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. */ + emoji_status_expiration_date?: number; + } + /** Internal type holding properties that supergroup and channel chats returned from `getChat` share. */ + interface LargeGetChat extends NonPrivateGetChat { + /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. Returned only in getChat. */ + linked_chat_id?: number; + } + /** Internal type representing private chats returned from `getChat`. */ + interface PrivateGetChat extends PrivateChat, NonGroupGetChat, PrivateAndChannelGetChat { + /** Bio of the other party in a private chat. Returned only in getChat. */ + bio?: string; + /** True, if privacy settings of the other party in the private chat allows to use tg://user?id= links only in chats with the user. Returned only in getChat. */ + has_private_forwards?: true; + /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat. */ + has_restricted_voice_and_video_messages?: true; + } + /** Internal type representing group chats returned from `getChat`. */ + interface GroupGetChat extends GroupChat, AnyGroupGetChat { + } + /** Internal type representing supergroup chats returned from `getChat`. */ + interface SupergroupGetChat extends SupergroupChat, NonGroupGetChat, AnyGroupGetChat, LargeGetChat { + /** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */ + join_to_send_messages?: true; + /** True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. */ + join_by_request?: true; + /** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */ + slow_mode_delay?: number; + /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat. */ + unrestrict_boost_count?: number; + /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. */ + has_aggressive_anti_spam_enabled?: true; + /** True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat. */ + has_visible_history?: boolean; + /** For supergroups, name of group sticker set. Returned only in getChat. */ + sticker_set_name?: string; + /** For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in getChat. */ + custom_emoji_sticker_set_name?: string; + /** For supergroups, the location to which the supergroup is connected. Returned only in getChat. */ + location?: ChatLocation; + } + /** Internal type representing channel chats returned from `getChat`. */ + interface ChannelGetChat extends ChannelChat, NonGroupGetChat, LargeGetChat, PrivateAndChannelGetChat { + /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat. */ + profile_accent_color_id?: number; + /** Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat. */ + profile_background_custom_emoji_id?: string; + } +} +/** This object represents a chat. */ +export type Chat = Chat.PrivateChat | Chat.GroupChat | Chat.SupergroupChat | Chat.ChannelChat; +/** This object represents a Telegram user or bot that was returned by `getChat`. */ +export type ChatFromGetChat = Chat.PrivateGetChat | Chat.GroupGetChat | Chat.SupergroupGetChat | Chat.ChannelGetChat; +/** This object represent a user's profile pictures. */ +export interface UserProfilePhotos { + /** Total number of profile pictures the target user has */ + total_count: number; + /** Requested profile pictures (in up to 4 sizes each) */ + photos: PhotoSize[][]; +} +/** This object represents a chat photo. */ +export interface ChatPhoto { + /** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */ + small_file_id: string; + /** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + small_file_unique_id: string; + /** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */ + big_file_id: string; + /** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + big_file_unique_id: string; +} +/** Represents an invite link for a chat. */ +export interface ChatInviteLink { + /** The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”. */ + invite_link: string; + /** Creator of the link */ + creator: User; + /** True, if users joining the chat via the link need to be approved by chat administrators */ + creates_join_request: boolean; + /** True, if the link is primary */ + is_primary: boolean; + /** True, if the link is revoked */ + is_revoked: boolean; + /** Invite link name */ + name?: string; + /** Point in time (Unix timestamp) when the link will expire or has been expired */ + expire_date?: number; + /** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */ + member_limit?: number; + /** Number of pending join requests created using this link */ + pending_join_request_count?: number; +} +/** Represents the rights of an administrator in a chat. */ +export interface ChatAdministratorRights { + /** True, if the user's presence in the chat is hidden */ + is_anonymous: boolean; + /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege */ + can_manage_chat: boolean; + /** True, if the administrator can delete messages of other users */ + can_delete_messages: boolean; + /** True, if the administrator can manage video chats */ + can_manage_video_chats: boolean; + /** True, if the administrator can restrict, ban or unban chat members */ + can_restrict_members: boolean; + /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */ + can_promote_members: boolean; + /** True, if the user is allowed to change the chat title, photo and other settings */ + can_change_info: boolean; + /** True, if the user is allowed to invite new users to the chat */ + can_invite_users: boolean; + /** True, if the administrator can post in the channel; channels only */ + can_post_messages?: boolean; + /** True, if the administrator can edit messages of other users and can pin messages; channels only */ + can_edit_messages?: boolean; + /** True, if the user is allowed to pin messages; groups and supergroups only */ + can_pin_messages?: boolean; + /** True, if the administrator can post stories to the chat */ + can_post_stories?: boolean; + /** True, if the administrator can edit stories posted by other users */ + can_edit_stories?: boolean; + /** True, if the administrator can delete stories posted by other users */ + can_delete_stories?: boolean; + /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */ + can_manage_topics?: boolean; +} +/** This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported: +- ChatMemberOwner +- ChatMemberAdministrator +- ChatMemberMember +- ChatMemberRestricted +- ChatMemberLeft +- ChatMemberBanned */ +export type ChatMember = ChatMemberOwner | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned; +export interface AbstractChatMember { + /** The member's status in the chat */ + status: string; + /** Information about the user */ + user: User; +} +/** Represents a chat member that owns the chat and has all administrator privileges. */ +export interface ChatMemberOwner extends AbstractChatMember { + status: "creator"; + /** True, if the user's presence in the chat is hidden */ + is_anonymous: boolean; + /** Custom title for this user */ + custom_title?: string; +} +/** Represents a chat member that has some additional privileges. */ +export interface ChatMemberAdministrator extends AbstractChatMember { + status: "administrator"; + /** True, if the bot is allowed to edit administrator privileges of that user */ + can_be_edited: boolean; + /** True, if the user's presence in the chat is hidden */ + is_anonymous: boolean; + /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege */ + can_manage_chat: boolean; + /** True, if the administrator can delete messages of other users */ + can_delete_messages: boolean; + /** True, if the administrator can manage video chats */ + can_manage_video_chats: boolean; + /** True, if the administrator can restrict, ban or unban chat members */ + can_restrict_members: boolean; + /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */ + can_promote_members: boolean; + /** True, if the user is allowed to change the chat title, photo and other settings */ + can_change_info: boolean; + /** True, if the user is allowed to invite new users to the chat */ + can_invite_users: boolean; + /** True, if the administrator can post in the channel; channels only */ + can_post_messages?: boolean; + /** True, if the administrator can edit messages of other users and can pin messages; channels only */ + can_edit_messages?: boolean; + /** True, if the user is allowed to pin messages; groups and supergroups only */ + can_pin_messages?: boolean; + /** True, if the administrator can post stories to the chat */ + can_post_stories?: boolean; + /** True, if the administrator can edit stories posted by other users */ + can_edit_stories?: boolean; + /** True, if the administrator can delete stories posted by other users */ + can_delete_stories?: boolean; + /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */ + can_manage_topics?: boolean; + /** Custom title for this user */ + custom_title?: string; +} +/** Represents a chat member that has no additional privileges or restrictions. */ +export interface ChatMemberMember extends AbstractChatMember { + status: "member"; +} +/** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */ +export interface ChatMemberRestricted extends AbstractChatMember { + status: "restricted"; + /** True, if the user is a member of the chat at the moment of the request */ + is_member: boolean; + /** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */ + can_send_messages: boolean; + /** True, if the user is allowed to send audios */ + can_send_audios: boolean; + /** True, if the user is allowed to send documents */ + can_send_documents: boolean; + /** True, if the user is allowed to send photos */ + can_send_photos: boolean; + /** True, if the user is allowed to send videos */ + can_send_videos: boolean; + /** True, if the user is allowed to send video notes */ + can_send_video_notes: boolean; + /** True, if the user is allowed to send voice notes */ + can_send_voice_notes: boolean; + /** True, if the user is allowed to send polls */ + can_send_polls: boolean; + /** True, if the user is allowed to send animations, games, stickers and use inline bots */ + can_send_other_messages: boolean; + /** True, if the user is allowed to add web page previews to their messages */ + can_add_web_page_previews: boolean; + /** True, if the user is allowed to change the chat title, photo and other settings */ + can_change_info: boolean; + /** True, if the user is allowed to invite new users to the chat */ + can_invite_users: boolean; + /** True, if the user is allowed to pin messages */ + can_pin_messages: boolean; + /** True, if the user is allowed to create forum topics */ + can_manage_topics: boolean; + /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever */ + until_date: number; +} +/** Represents a chat member that isn't currently a member of the chat, but may join it themselves. */ +export interface ChatMemberLeft extends AbstractChatMember { + status: "left"; +} +/** Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. */ +export interface ChatMemberBanned extends AbstractChatMember { + status: "kicked"; + /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever */ + until_date: number; +} +/** This object represents changes in the status of a chat member. */ +export interface ChatMemberUpdated { + /** Chat the user belongs to */ + chat: Chat; + /** Performer of the action, which resulted in the change */ + from: User; + /** Date the change was done in Unix time */ + date: number; + /** Previous information about the chat member */ + old_chat_member: ChatMember; + /** New information about the chat member */ + new_chat_member: ChatMember; + /** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */ + invite_link?: ChatInviteLink; + /** True, if the user joined the chat via a chat folder invite link */ + via_chat_folder_invite_link?: boolean; +} +/** Represents a join request sent to a chat. */ +export interface ChatJoinRequest { + /** Chat to which the request was sent */ + chat: Chat.SupergroupChat | Chat.ChannelChat; + /** User that sent the join request */ + from: User; + /** Identifier of a private chat with the user who sent the join request. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. */ + user_chat_id: number; + /** Date the request was sent in Unix time */ + date: number; + /** Bio of the user. */ + bio?: string; + /** Chat invite link that was used by the user to send the join request */ + invite_link?: ChatInviteLink; +} +/** Describes actions that a non-administrator user is allowed to take in a chat. */ +export interface ChatPermissions { + /** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */ + can_send_messages?: boolean; + /** True, if the user is allowed to send audios */ + can_send_audios?: boolean; + /** True, if the user is allowed to send documents */ + can_send_documents?: boolean; + /** True, if the user is allowed to send photos */ + can_send_photos?: boolean; + /** True, if the user is allowed to send videos */ + can_send_videos?: boolean; + /** True, if the user is allowed to send video notes */ + can_send_video_notes?: boolean; + /** True, if the user is allowed to send voice notes */ + can_send_voice_notes?: boolean; + /** True, if the user is allowed to send polls */ + can_send_polls?: boolean; + /** True, if the user is allowed to send animations, games, stickers and use inline bots */ + can_send_other_messages?: boolean; + /** True, if the user is allowed to add web page previews to their messages */ + can_add_web_page_previews?: boolean; + /** True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */ + can_change_info?: boolean; + /** True, if the user is allowed to invite new users to the chat */ + can_invite_users?: boolean; + /** True, if the user is allowed to pin messages. Ignored in public supergroups */ + can_pin_messages?: boolean; + /** True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages */ + can_manage_topics?: boolean; +} +/** Represents a location to which a chat is connected. */ +export interface ChatLocation { + /** The location to which the supergroup is connected. Can't be a live location. */ + location: Location; + /** Location address; 1-64 characters, as defined by the chat owner */ + address: string; +} +/** This object describes the type of a reaction. Currently, it can be one of + * - ReactionTypeEmoji + * - ReactionTypeCustomEmoji + */ +export type ReactionType = ReactionTypeEmoji | ReactionTypeCustomEmoji; +export interface AbstractReactionType { + /** Type of the reaction */ + type: string; +} +export type TelegramEmoji = "👍" | "👎" | "❤" | "🔥" | "🥰" | "👏" | "😁" | "🤔" | "🤯" | "😱" | "🤬" | "😢" | "🎉" | "🤩" | "🤮" | "💩" | "🙏" | "👌" | "🕊" | "🤡" | "🥱" | "🥴" | "😍" | "🐳" | "❤‍🔥" | "🌚" | "🌭" | "💯" | "🤣" | "⚡" | "🍌" | "🏆" | "💔" | "🤨" | "😐" | "🍓" | "🍾" | "💋" | "🖕" | "😈" | "😴" | "😭" | "🤓" | "👻" | "👨‍💻" | "👀" | "🎃" | "🙈" | "😇" | "😨" | "🤝" | "✍" | "🤗" | "🫡" | "🎅" | "🎄" | "☃" | "💅" | "🤪" | "🗿" | "🆒" | "💘" | "🙉" | "🦄" | "😘" | "💊" | "🙊" | "😎" | "👾" | "🤷‍♂" | "🤷" | "🤷‍♀" | "😡"; +/** The reaction is based on an emoji. */ +export interface ReactionTypeEmoji extends AbstractReactionType { + type: "emoji"; + /** Reaction emoji. */ + emoji: TelegramEmoji; +} +/** The reaction is based on a custom emoji. */ +export interface ReactionTypeCustomEmoji extends AbstractReactionType { + type: "custom_emoji"; + /** Custom emoji identifier */ + custom_emoji_id: string; +} +/** Represents a reaction added to a message along with the number of times it was added. */ +export interface ReactionCount { + /** Type of the reaction */ + type: ReactionType; + /** Number of times the reaction was added */ + total_count: number; +} +/** This object represents a change of a reaction on a message performed by a user. */ +export interface MessageReactionUpdated { + /** The chat containing the message the user reacted to */ + chat: Chat; + /** Unique identifier of the message inside the chat */ + message_id: number; + /** The user that changed the reaction, if the user isn't anonymous */ + user?: User; + /** The chat on behalf of which the reaction was changed, if the user is anonymous */ + actor_chat?: Chat; + /** Date of the change in Unix time */ + date: number; + /** Previous list of reaction types that were set by the user */ + old_reaction: ReactionType[]; + /** New list of reaction types that have been set by the user */ + new_reaction: ReactionType[]; +} +/** This object represents reaction changes on a message with anonymous reactions. */ +export interface MessageReactionCountUpdated { + /** The chat containing the message */ + chat: Chat; + /** Unique message identifier inside the chat */ + message_id: number; + /** Date of the change in Unix time */ + date: number; + /** List of reactions that are present on the message */ + reactions: ReactionCount[]; +} +/** This object represents a forum topic. */ +export interface ForumTopic { + /** Unique identifier of the forum topic */ + message_thread_id: number; + /** Name of the topic */ + name: string; + /** Color of the topic icon in RGB format */ + icon_color: number; + /** Unique identifier of the custom emoji shown as the topic icon */ + icon_custom_emoji_id?: string; +} +/** This object represents a bot command. */ +export interface BotCommand { + /** Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. */ + command: string; + /** Description of the command; 1-256 characters. */ + description: string; +} +/** This object describes the source of a chat boost. It can be one of + +- ChatBoostSourcePremium +- ChatBoostSourceGiftCode +- ChatBoostSourceGiveaway +*/ +type ChatBoostSource = ChatBoostSourcePremium | ChatBoostSourceGiftCode | ChatBoostSourceGiveaway; +export interface AbstractChatBoostSource { + /** Source of the boost */ + source: string; +} +/** The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. */ +export interface ChatBoostSourcePremium extends AbstractChatBoostSource { + source: "premium"; + /** User that boosted the chat. */ + user: User; +} +/** The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */ +export interface ChatBoostSourceGiftCode extends AbstractChatBoostSource { + source: "gift_code"; + /** User for which the gift code was created. */ + user: User; +} +/** The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */ +export interface ChatBoostSourceGiveaway extends AbstractChatBoostSource { + source: "giveaway"; + /** Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet. */ + giveaway_message_id: number; + /** User that won the prize in the giveaway if any. */ + user?: User; + /** True, if the giveaway was completed, but there was no user to win the prize */ + is_unclaimed?: true; +} +/** This object contains information about a chat boost. */ +export interface ChatBoost { + /** Unique identifier of the boost */ + boost_id: string; + /** Point in time (Unix timestamp) when the chat was boosted */ + add_date: number; + /** Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged */ + expiration_date: number; + /** Source of the added boost */ + source: ChatBoostSource; +} +/** This object represents a boost added to a chat or changed. */ +export interface ChatBoostUpdated { + /** Chat which was boosted */ + chat: Chat; + /** Infomation about the chat boost */ + boost: ChatBoost; +} +/** This object represents a boost removed from a chat. */ +export interface ChatBoostRemoved { + /** Chat which was boosted */ + chat: Chat; + /** Unique identifier of the boost */ + boost_id: string; + /** Point in time (Unix timestamp) when the boost was removed */ + remove_date: number; + /** Source of the removed boost */ + source: ChatBoostSource; +} +/** This object represents a list of boosts added to a chat by a user. */ +export interface UserChatBoosts { + /** The list of boosts added to the chat by the user */ + boosts: ChatBoost[]; +} +/** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot/. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. + +> The maximum file size to download is 20 MB +*/ +export interface File { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */ + file_size?: number; + /** File path. Use `https://api.telegram.org/file/bot/` to get the file. */ + file_path?: string; +} +export {}; diff --git a/node_modules/@telegraf/types/markup.d.ts b/node_modules/@telegraf/types/markup.d.ts new file mode 100644 index 0000000..905ace5 --- /dev/null +++ b/node_modules/@telegraf/types/markup.d.ts @@ -0,0 +1,228 @@ +import type { ChatAdministratorRights, User } from "./manage.js"; +import type { MaybeInaccessibleMessage } from "./message.js"; +/** This object represents an inline keyboard that appears right next to the message it belongs to. */ +export interface InlineKeyboardMarkup { + /** Array of button rows, each represented by an Array of InlineKeyboardButton objects */ + inline_keyboard: InlineKeyboardButton[][]; +} +export declare namespace InlineKeyboardButton { + interface AbstractInlineKeyboardButton { + /** Label text on the button */ + text: string; + } + interface UrlButton extends AbstractInlineKeyboardButton { + /** HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */ + url: string; + } + interface CallbackButton extends AbstractInlineKeyboardButton { + /** Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */ + callback_data: string; + } + interface WebAppButton extends AbstractInlineKeyboardButton { + /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. */ + web_app: WebAppInfo; + } + interface LoginButton extends AbstractInlineKeyboardButton { + /** An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */ + login_url: LoginUrl; + } + interface SwitchInlineButton extends AbstractInlineKeyboardButton { + /** If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted. */ + switch_inline_query: string; + } + interface SwitchInlineCurrentChatButton extends AbstractInlineKeyboardButton { + /** If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted. + + This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. */ + switch_inline_query_current_chat: string; + } + interface SwitchInlineChosenChatButton extends AbstractInlineKeyboardButton { + /** If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field */ + switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat; + } + interface GameButton extends AbstractInlineKeyboardButton { + /** Description of the game that will be launched when the user presses the button. + + NOTE: This type of button must always be the first button in the first row. */ + callback_game: CallbackGame; + } + interface PayButton extends AbstractInlineKeyboardButton { + /** Specify True, to send a Pay button. + + NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */ + pay: boolean; + } +} +/** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */ +export type InlineKeyboardButton = InlineKeyboardButton.CallbackButton | InlineKeyboardButton.GameButton | InlineKeyboardButton.LoginButton | InlineKeyboardButton.PayButton | InlineKeyboardButton.SwitchInlineButton | InlineKeyboardButton.SwitchInlineCurrentChatButton | InlineKeyboardButton.SwitchInlineChosenChatButton | InlineKeyboardButton.UrlButton | InlineKeyboardButton.WebAppButton; +/** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in. +Telegram apps support these buttons as of version 5.7. */ +export interface LoginUrl { + /** An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data. + + NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. */ + url: string; + /** New text of the button in forwarded messages. */ + forward_text?: string; + /** Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. */ + bot_username?: string; + /** Pass True to request the permission for your bot to send messages to the user. */ + request_write_access?: boolean; +} +/** This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query. */ +export interface SwitchInlineQueryChosenChat { + /** The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted */ + query?: string; + /** True, if private chats with users can be chosen */ + allow_user_chats?: boolean; + /** True, if private chats with bots can be chosen */ + allow_bot_chats?: boolean; + /** True, if group and supergroup chats can be chosen */ + allow_group_chats?: boolean; + /** True, if channel chats can be chosen */ + allow_channel_chats?: boolean; +} +/** A placeholder, currently holds no information. Use BotFather to set up your game. */ +export interface CallbackGame { +} +export declare namespace CallbackQuery { + interface AbstractQuery { + /** Unique identifier for this query */ + id: string; + /** Sender */ + from: User; + /** Message sent by the bot with the callback button that originated the query */ + message?: MaybeInaccessibleMessage; + /** Identifier of the message sent via the bot in inline mode, that originated the query. */ + inline_message_id?: string; + /** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */ + chat_instance: string; + } + interface DataQuery extends AbstractQuery { + /** Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data. */ + data: string; + } + interface GameQuery extends AbstractQuery { + /** Short name of a Game to be returned, serves as the unique identifier for the game */ + game_short_name: string; + } +} +/** This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present. + + NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). */ +export type CallbackQuery = CallbackQuery.DataQuery | CallbackQuery.GameQuery; +/** This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). */ +export interface ReplyKeyboardMarkup { + /** Array of button rows, each represented by an Array of KeyboardButton objects */ + keyboard: KeyboardButton[][]; + /** Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. */ + is_persistent?: boolean; + /** Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */ + resize_keyboard?: boolean; + /** Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */ + one_time_keyboard?: boolean; + /** The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */ + input_field_placeholder?: string; + /** Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. + + Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. */ + selective?: boolean; +} +export declare namespace KeyboardButton { + interface CommonButton { + /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */ + text: string; + } + interface RequestUsersButton extends CommonButton { + /** If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */ + request_users: KeyboardButtonRequestUsers; + } + interface RequestChatButton extends CommonButton { + /** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */ + request_chat: KeyboardButtonRequestChat; + } + interface RequestContactButton extends CommonButton { + /** If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */ + request_contact: boolean; + } + interface RequestLocationButton extends CommonButton { + /** If True, the user's current location will be sent when the button is pressed. Available in private chats only. */ + request_location: boolean; + } + interface RequestPollButton extends CommonButton { + /** If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */ + request_poll: KeyboardButtonPollType; + } + interface WebAppButton extends CommonButton { + /** If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */ + web_app: WebAppInfo; + } +} +/** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */ +export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUsersButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.WebAppButton | string; +/** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */ +export interface KeyboardButtonPollType { + /** If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */ + type?: "quiz" | "regular"; +} +/** Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). */ +export interface ReplyKeyboardRemove { + /** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) */ + remove_keyboard: true; + /** Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. + + Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */ + selective?: boolean; +} +/** Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. + +Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll: + +Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish. + +Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'. + +The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user. */ +export interface ForceReply { + /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */ + force_reply: true; + /** The placeholder to be shown in the input field when the reply is active; 1-64 characters */ + input_field_placeholder?: string; + /** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */ + selective?: boolean; +} +/** Describes a Web App. */ +export interface WebAppInfo { + /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */ + url: string; +} +/** This object defines the criteria used to request suitable users. The identifiers of the selected users will be shared with the bot when the corresponding button is pressed. */ +export interface KeyboardButtonRequestUsers { + /** Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message. */ + request_id: number; + /** Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied. */ + user_is_bot?: boolean; + /** Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied. */ + user_is_premium?: boolean; + /** The maximum number of users to be selected; 1-10. Defaults to 1. */ + max_quantity?: number; +} +/** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */ +export interface KeyboardButtonRequestChat { + /** Signed 32-bit identifier of the request, which will be received back in the ChatShared object. Must be unique within the message */ + request_id: number; + /** Pass True to request a channel chat, pass False to request a group or a supergroup chat. */ + chat_is_channel: boolean; + /** Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied. */ + chat_is_forum?: boolean; + /** Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied. */ + chat_has_username?: boolean; + /** Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied. */ + chat_is_created?: boolean; + /** An object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied. */ + user_administrator_rights?: ChatAdministratorRights; + /** An object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied. */ + bot_administrator_rights?: ChatAdministratorRights; + /** Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */ + bot_is_member?: boolean; +} diff --git a/node_modules/@telegraf/types/message.d.ts b/node_modules/@telegraf/types/message.d.ts new file mode 100644 index 0000000..686d5e9 --- /dev/null +++ b/node_modules/@telegraf/types/message.d.ts @@ -0,0 +1,1087 @@ +import type { Chat, File, User } from "./manage.js"; +import type { InlineKeyboardMarkup } from "./markup.js"; +import type { PassportData } from "./passport.js"; +import type { Invoice, SuccessfulPayment } from "./payment.js"; +export declare namespace Message { + interface ServiceMessage { + /** Unique message identifier inside this chat */ + message_id: number; + /** Unique identifier of a message thread or a forum topic to which the message belongs; for supergroups only */ + message_thread_id?: number; + /** Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */ + from?: User; + /** Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */ + sender_chat?: Chat; + /** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */ + date: number; + /** Chat the message belongs to */ + chat: Chat; + /** True, if the message is sent to a forum topic */ + is_topic_message?: boolean; + } + interface CommonMessage extends ServiceMessage { + /** If the sender of the message boosted the chat, the number of boosts added by the user */ + sender_boost_count?: number; + /** Information about the original message for forwarded messages */ + forward_origin?: MessageOrigin; + /** True, if the message is a channel post that was automatically forwarded to the connected discussion group */ + is_automatic_forward?: true; + /** For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */ + reply_to_message?: ReplyMessage; + /** Information about the message that is being replied to, which may come from another chat or forum topic */ + external_reply?: ExternalReplyInfo; + /** For replies that quote part of the original message, the quoted part of the message */ + quote?: TextQuote; + /** For replies to a story, the original story */ + reply_to_story?: Story; + /** Bot through which the message was sent */ + via_bot?: User; + /** Date the message was last edited in Unix time */ + edit_date?: number; + /** True, if the message can't be forwarded */ + has_protected_content?: true; + /** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */ + author_signature?: string; + /** Options used for link preview generation for the message, if it is a text message and link preview options were changed */ + link_preview_options?: LinkPreviewOptions; + /** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ + reply_markup?: InlineKeyboardMarkup; + } + interface TextMessage extends CommonMessage { + /** For text messages, the actual UTF-8 text of the message */ + text: string; + /** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */ + entities?: MessageEntity[]; + } + interface CaptionableMessage extends CommonMessage { + /** Caption for the animation, audio, document, photo, video or voice */ + caption?: string; + /** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */ + caption_entities?: MessageEntity[]; + } + interface MediaMessage extends CaptionableMessage { + /** The unique identifier of a media message group this message belongs to */ + media_group_id?: string; + /** True, if the message media is covered by a spoiler animation */ + has_media_spoiler?: true; + } + interface AudioMessage extends MediaMessage { + /** Message is an audio file, information about the file */ + audio: Audio; + } + interface DocumentMessage extends MediaMessage { + /** Message is a general file, information about the file */ + document: Document; + } + interface AnimationMessage extends DocumentMessage { + /** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */ + animation: Animation; + } + interface PhotoMessage extends MediaMessage { + /** Message is a photo, available sizes of the photo */ + photo: PhotoSize[]; + } + interface StickerMessage extends CommonMessage { + /** Message is a sticker, information about the sticker */ + sticker: Sticker; + } + interface StoryMessage extends CommonMessage { + /** Message is a forwarded story. Currently holds no information */ + story: Story; + } + interface VideoMessage extends MediaMessage { + /** Message is a video, information about the video */ + video: Video; + } + interface VideoNoteMessage extends CommonMessage { + /** Message is a video note, information about the video message */ + video_note: VideoNote; + } + interface VoiceMessage extends CaptionableMessage { + /** Message is a voice message, information about the file */ + voice: Voice; + } + interface ContactMessage extends CommonMessage { + /** Message is a shared contact, information about the contact */ + contact: Contact; + } + interface DiceMessage extends CommonMessage { + /** Message is a dice with random value */ + dice: Dice; + } + interface GameMessage extends CommonMessage { + /** Message is a game, information about the game. More about games » */ + game: Game; + } + interface PollMessage extends CommonMessage { + /** Message is a native poll, information about the poll */ + poll: Poll; + } + interface LocationMessage extends CommonMessage { + /** Message is a shared location, information about the location */ + location: Location; + } + interface VenueMessage extends LocationMessage { + /** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */ + venue: Venue; + } + interface NewChatMembersMessage extends ServiceMessage { + /** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */ + new_chat_members: User[]; + } + interface LeftChatMemberMessage extends ServiceMessage { + /** A member was removed from the group, information about them (this member may be the bot itself) */ + left_chat_member: User; + } + interface NewChatTitleMessage extends ServiceMessage { + /** A chat title was changed to this value */ + new_chat_title: string; + } + interface NewChatPhotoMessage extends ServiceMessage { + /** A chat photo was change to this value */ + new_chat_photo: PhotoSize[]; + } + interface DeleteChatPhotoMessage extends ServiceMessage { + /** Service message: the chat photo was deleted */ + delete_chat_photo: true; + } + interface GroupChatCreatedMessage extends ServiceMessage { + /** Service message: the group has been created */ + group_chat_created: true; + } + interface SupergroupChatCreated extends ServiceMessage { + /** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */ + supergroup_chat_created: true; + } + interface ChannelChatCreatedMessage extends ServiceMessage { + /** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */ + channel_chat_created: true; + } + interface MessageAutoDeleteTimerChangedMessage extends ServiceMessage { + /** Service message: auto-delete timer settings changed in the chat */ + message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged; + } + interface MigrateToChatIdMessage extends ServiceMessage { + /** The group has been migrated to a supergroup with the specified identifier. */ + migrate_to_chat_id: number; + } + interface MigrateFromChatIdMessage extends ServiceMessage { + /** The supergroup has been migrated from a group with the specified identifier. */ + migrate_from_chat_id: number; + } + interface PinnedMessageMessage extends ServiceMessage { + /** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */ + pinned_message: Omit; + } + interface InvoiceMessage extends ServiceMessage { + /** Message is an invoice for a payment, information about the invoice. More about payments » */ + invoice: Invoice; + } + interface SuccessfulPaymentMessage extends ServiceMessage { + /** Message is a service message about a successful payment, information about the payment. More about payments » */ + successful_payment: SuccessfulPayment; + } + interface UsersSharedMessage extends ServiceMessage { + /** Service message: a user was shared with the bot */ + users_shared: UsersShared; + } + interface ChatSharedMessage extends ServiceMessage { + /** Service message: a chat was shared with the bot */ + chat_shared: ChatShared; + } + interface ConnectedWebsiteMessage extends ServiceMessage { + /** The domain name of the website on which the user has logged in. More about Telegram Login » */ + connected_website: string; + } + interface WriteAccessAllowedMessage extends ServiceMessage { + /** Service message: the user allowed the bot added to the attachment menu to write messages */ + write_access_allowed: WriteAccessAllowed; + } + interface PassportDataMessage extends ServiceMessage { + /** Telegram Passport data */ + passport_data: PassportData; + } + interface ProximityAlertTriggeredMessage extends ServiceMessage { + /** Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */ + proximity_alert_triggered: ProximityAlertTriggered; + } + interface BoostAddedMessage extends ServiceMessage { + /** Service message: user boosted the chat */ + boost_added: ChatBoostAdded; + } + interface ForumTopicCreatedMessage extends ServiceMessage { + /** Service message: forum topic created */ + forum_topic_created: ForumTopicCreated; + } + interface ForumTopicEditedMessage extends ServiceMessage { + /** Service message: forum topic edited */ + forum_topic_edited: ForumTopicEdited; + } + interface ForumTopicClosedMessage extends ServiceMessage { + /** Service message: forum topic closed */ + forum_topic_closed: ForumTopicClosed; + } + interface ForumTopicReopenedMessage extends ServiceMessage { + /** Service message: forum topic reopened */ + forum_topic_reopened: ForumTopicReopened; + } + interface GeneralForumTopicHiddenMessage extends ServiceMessage { + /** Service message: the 'General' forum topic hidden */ + general_forum_topic_hidden: GeneralForumTopicHidden; + } + interface GeneralForumTopicUnhiddenMessage extends ServiceMessage { + /** Service message: the 'General' forum topic unhidden */ + general_forum_topic_unhidden: GeneralForumTopicUnhidden; + } + interface GiveawayCreatedMessage extends ServiceMessage { + /** Service message: a scheduled giveaway was created */ + giveaway_created: GiveawayCreated; + } + interface GiveawayMessage extends ServiceMessage { + /** The message is a scheduled giveaway message */ + giveaway: Giveaway; + } + interface GiveawayWinnersMessage extends ServiceMessage { + /** A giveaway with public winners was completed */ + giveaway_winners: GiveawayWinners; + } + interface GiveawayCompletedMessage extends ServiceMessage { + /** Service message: a giveaway without public winners was completed */ + giveaway_completed: GiveawayCompleted; + } + interface VideoChatScheduledMessage extends ServiceMessage { + /** Service message: video chat scheduled */ + video_chat_scheduled: VideoChatScheduled; + } + interface VideoChatStartedMessage extends ServiceMessage { + /** Service message: video chat started */ + video_chat_started: VideoChatStarted; + } + interface VideoChatEndedMessage extends ServiceMessage { + /** Service message: video chat ended */ + video_chat_ended: VideoChatEnded; + } + interface VideoChatParticipantsInvitedMessage extends ServiceMessage { + /** Service message: new participants invited to a video chat */ + video_chat_participants_invited: VideoChatParticipantsInvited; + } + interface WebAppDataMessage extends ServiceMessage { + /** Service message: data sent by a Web App */ + web_app_data: WebAppData; + } +} +/** Helper type that bundles all possible `Message.ServiceMessage`s. More specifically, bundles all messages that do not have a `reply_to_message` field, i.e. are not a `Message.CommonMessage`. */ +export type ServiceMessageBundle = Message.NewChatMembersMessage | Message.LeftChatMemberMessage | Message.NewChatTitleMessage | Message.NewChatPhotoMessage | Message.DeleteChatPhotoMessage | Message.GroupChatCreatedMessage | Message.SupergroupChatCreated | Message.ChannelChatCreatedMessage | Message.MessageAutoDeleteTimerChangedMessage | Message.MigrateToChatIdMessage | Message.MigrateFromChatIdMessage | Message.PinnedMessageMessage | Message.InvoiceMessage | Message.SuccessfulPaymentMessage | Message.UsersSharedMessage | Message.ChatSharedMessage | Message.ConnectedWebsiteMessage | Message.WriteAccessAllowedMessage | Message.PassportDataMessage | Message.ProximityAlertTriggeredMessage | Message.BoostAddedMessage | Message.ForumTopicCreatedMessage | Message.ForumTopicEditedMessage | Message.ForumTopicClosedMessage | Message.ForumTopicReopenedMessage | Message.GeneralForumTopicHiddenMessage | Message.GeneralForumTopicUnhiddenMessage | Message.GiveawayCreatedMessage | Message.GiveawayMessage | Message.GiveawayWinnersMessage | Message.GiveawayCompletedMessage | Message.VideoChatScheduledMessage | Message.VideoChatStartedMessage | Message.VideoChatEndedMessage | Message.VideoChatParticipantsInvitedMessage | Message.WebAppDataMessage; +/** Helper type that bundles all possible `Message.CommonMessage`s. More specifically, bundles all messages that do have a `reply_to_message` field, i.e. are a `Message.CommonMessage`. */ +export type CommonMessageBundle = Message.AnimationMessage | Message.AudioMessage | Message.ContactMessage | Message.DiceMessage | Message.DocumentMessage | Message.GameMessage | Message.LocationMessage | Message.PhotoMessage | Message.PollMessage | Message.StickerMessage | Message.StoryMessage | Message.TextMessage | Message.VenueMessage | Message.VideoMessage | Message.VideoNoteMessage | Message.VoiceMessage; +/** Helper type that represents a message which occurs in a `reply_to_message` field. */ +type ReplyMessage = ServiceMessageBundle | (CommonMessageBundle & { + reply_to_message: undefined; +}); +/** This object represents a message. */ +export type Message = ServiceMessageBundle | CommonMessageBundle; +/** This object represents a unique message identifier. */ +export interface MessageId { + /** Unique message identifier */ + message_id: number; +} +/** This object describes a message that was deleted or is otherwise inaccessible to the bot. */ +export interface InaccessibleMessage { + /** Chat the message belonged to. */ + chat: Chat; + /** Unique message identifier inside the chat. */ + message_id: number; + /** Always 0. The field can be used to differentiate regular and inaccessible messages. */ + date: 0; +} +/** This object describes a message that can be inaccessible to the bot. It can be one of + +- Message +- InaccessibleMessage */ +export type MaybeInaccessibleMessage = Message | InaccessibleMessage; +/** Describes an inline message sent by a Web App on behalf of a user. */ +export interface SentWebAppMessage { + /** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */ + inline_message_id: string; +} +/** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, spoiler text, block quotations as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can specify text entities directly, or use markdown-style or HTML-style formatting. + +Note that Telegram clients will display an **alert** to the user before opening an inline link ('Open this link?' together with the full URL). + +Message entities can be nested, providing following restrictions are met: +- If two entities have common characters, then one of them is fully contained inside another. +- bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code. +- blockquote entities can't be nested. +- All other entities can't contain each other. + +Links `tg://user?id=` can be used to mention a user by their ID without using a username. Please note: + +- These links will work only if they are used inside an inline link or in an inline keyboard button. For example, they will not work, when used in a message text. +- Unless the user is a member of the chat where they were mentioned, these mentions are only guaranteed to work if the user has contacted the bot in private in the past or has sent a callback query to the bot via an inline button and doesn't have Forwarded Messages privacy enabled for the bot. + +You can find the list of programming and markup languages for which syntax highlighting is supported at [libprisma#supported-languages](https://github.com/TelegramMessenger/libprisma#supported-languages). + +#### MarkdownV2 style +To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message: + +``` +*bold \*text* +_italic \*text_ +__underline__ +~strikethrough~ +||spoiler|| +*bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold* +[inline URL](http://www.example.com/) +[inline mention of a user](tg://user?id=123456789) +![👍](tg://emoji?id=5368324170671202286) +`inline fixed-width code` +`​`​` +pre-formatted fixed-width code block +`​`​` +`​`​`python +pre-formatted fixed-width code block written in the Python programming language +`​`​` +>Block quotation started +>Block quotation continued +>The last line of the block quotation +``` +Please note: + +- Any character with code between 1 and 126 inclusively can be escaped anywhere with a preceding '\' character, in which case it is treated as an ordinary character and not a part of the markup. This implies that '\' character usually must be escaped with a preceding '\' character. +- Inside `pre` and `code` entities, all '`' and '\' characters must be escaped with a preceding '\' character. +- Inside the `(...)` part of the inline link and custom emoji definition, all ')' and '\' must be escaped with a preceding '\' character. +- In all other places characters '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' must be escaped with the preceding character '\'. +- In case of ambiguity between `italic` and `underline` entities `__` is always greadily treated from left to right as beginning or end of `underline` entity, so instead of `___italic underline___` use `___italic underline_\r__`, where `\r` is a character with code 13, which will be ignored. +- A valid emoji must be provided as an alternative value for the custom emoji. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker. +- Custom emoji entities can only be used by bots that purchased additional usernames on Fragment. + +#### HTML style +To use this mode, pass *HTML* in the *parse_mode* field. The following tags are currently supported: + +```html +bold, bold +italic, italic +underline, underline +strikethrough, strikethrough, strikethrough +spoiler, spoiler +bold italic bold italic bold strikethrough italic bold strikethrough spoiler underline italic bold bold +inline URL +inline mention of a user +👍 +inline fixed-width code +
pre-formatted fixed-width code block
+
pre-formatted fixed-width code block written in the Python programming language
+
Block quotation started\nBlock quotation continued\nThe last line of the block quotation
+``` +Please note: + +- Only the tags mentioned above are currently supported. +- All `<`, `>` and `&` symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (`<` with `<`, `>` with `>` and `&` with `&`). +- All numerical HTML entities are supported. +- The API currently supports only the following named HTML entities: `<`, `>`, `&` and `"`. +- Use nested `pre` and `code` tags, to define programming language for pre entity. +- Programming language can't be specified for standalone `code` tags. +- A valid emoji must be used as the content of the tg-emoji tag. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker. +- Custom emoji entities can only be used by bots that purchased additional usernames on Fragment. + +#### Markdown style +This is a legacy mode, retained for backward compatibility. To use this mode, pass *Markdown* in the *parse_mode* field. Use the following syntax in your message: + +``` +*bold text* +_italic text_ +[inline URL](http://www.example.com/) +[inline mention of a user](tg://user?id=123456789) +`inline fixed-width code` +`​`​` +pre-formatted fixed-width code block +`​`​` +`​`​`python +pre-formatted fixed-width code block written in the Python programming language +`​`​` +``` +Please note: + +- Entities must not be nested, use parse mode MarkdownV2 instead. +- There is no way to specify “underline”, “strikethrough”, “spoiler”, “blockquote” and “custom_emoji” entities, use parse mode MarkdownV2 instead. +- To escape characters '_', '*', '`', '[' outside of an entity, prepend the characters '\' before them. +- Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\__case_` for italic `snake_case` and `*2*\**2=4*` for bold `2*2=4`. */ +export type ParseMode = "Markdown" | "MarkdownV2" | "HTML"; +export declare namespace MessageEntity { + interface AbstractMessageEntity { + /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */ + type: string; + /** Offset in UTF-16 code units to the start of the entity */ + offset: number; + /** Length of the entity in UTF-16 code units */ + length: number; + } + interface CommonMessageEntity extends AbstractMessageEntity { + type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "blockquote" | "italic" | "underline" | "strikethrough" | "spoiler" | "code"; + } + interface PreMessageEntity extends AbstractMessageEntity { + type: "pre"; + /** For “pre” only, the programming language of the entity text */ + language?: string; + } + interface TextLinkMessageEntity extends AbstractMessageEntity { + type: "text_link"; + /** For “text_link” only, URL that will be opened after user taps on the text */ + url: string; + } + interface TextMentionMessageEntity extends AbstractMessageEntity { + type: "text_mention"; + /** For “text_mention” only, the mentioned user */ + user: User; + } + interface CustomEmojiMessageEntity extends AbstractMessageEntity { + type: "custom_emoji"; + /** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */ + custom_emoji_id: string; + } +} +/** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */ +export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity; +/** This object contains information about the quoted part of a message that is replied to by the given message. */ +export interface TextQuote { + /** Text of the quoted part of a message that is replied to by the given message */ + text: string; + /** Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes. */ + entities?: MessageEntity[]; + /** Approximate quote position in the original message in UTF-16 code units as specified by the sender */ + position: number; + /** True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. */ + is_manual?: true; +} +/** Base properties shared by all ExternalReplyInfo variants */ +export interface AbstractExternalReply { + /** Origin of the message replied to by the given message */ + origin: MessageOrigin; + /** Chat the original message belongs to. Available only if the chat is a supergroup or a channel. */ + chat?: Chat; + /** Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel. */ + message_id?: number; + /** Options used for link preview generation for the original message, if it is a text message */ + link_preview_options?: LinkPreviewOptions; +} +/** Properties shared by Animation, Photo, and Video ExternalReplyInfo */ +export interface AbstractExternalReplyMedia { + /** True, if the message media is covered by a spoiler animation */ + has_media_spoiler?: true; +} +export interface ExternalReplyAnimation extends AbstractExternalReply, AbstractExternalReplyMedia { + /** Message is an animation, information about the animation */ + animation: Animation; +} +export interface ExternalReplyAudio extends AbstractExternalReply { + /** Message is an audio file, information about the file */ + audio: Audio; +} +export interface ExternalReplyDocument extends AbstractExternalReply { + /** Message is a general file, information about the file */ + document: Document; +} +export interface ExternalReplyPhoto extends AbstractExternalReply, AbstractExternalReplyMedia { + /** Message is a photo, available sizes of the photo */ + photo: PhotoSize[]; +} +export interface ExternalReplySticker extends AbstractExternalReply { + /** Message is a sticker, information about the sticker */ + sticker: Sticker; +} +export interface ExternalReplyStory extends AbstractExternalReply { + /** Message is a forwarded story */ + story: Story; +} +export interface ExternalReplyVideo extends AbstractExternalReply, AbstractExternalReplyMedia { + /** Message is a video, information about the video */ + video: Video; +} +export interface ExternalReplyVideoNote extends AbstractExternalReply { + /** Message is a video note, information about the video message */ + video_note: VideoNote; +} +export interface ExternalReplyVoice extends AbstractExternalReply { + /** Message is a voice message, information about the file */ + voice: Voice; +} +export interface ExternalReplyContact extends AbstractExternalReply { + /** Message is a shared contact, information about the contact */ + contact: Contact; +} +export interface ExternalReplyDice extends AbstractExternalReply { + /** Message is a dice with random value */ + dice: Dice; +} +export interface ExternalReplyGame extends AbstractExternalReply { + /** Message is a game, information about the game. More about games » */ + game: Game; +} +export interface ExternalReplyGiveaway extends AbstractExternalReply { + /** Message is a scheduled giveaway, information about the giveaway */ + giveaway: Giveaway; +} +export interface ExternalReplyGiveawayWinners extends AbstractExternalReply { + /** A giveaway with public winners was completed */ + giveaway_winners: GiveawayWinners; +} +export interface ExternalReplyInvoice extends AbstractExternalReply { + /** Message is an invoice for a payment, information about the invoice. More about payments » */ + invoice: Invoice; +} +export interface ExternalReplyLocation extends AbstractExternalReply { + /** Message is a shared location, information about the location */ + location: Location; +} +export interface ExternalReplyPoll extends AbstractExternalReply { + /** Message is a native poll, information about the poll */ + poll: Poll; +} +export interface ExternalReplyVenue extends AbstractExternalReply { + /** Message is a venue, information about the venue */ + venue: Venue; +} +/** This object contains information about a message that is being replied to, which may come from another chat or forum topic. */ +export type ExternalReplyInfo = ExternalReplyAnimation | ExternalReplyAudio | ExternalReplyDocument | ExternalReplyPhoto | ExternalReplySticker | ExternalReplyStory | ExternalReplyVideo | ExternalReplyVideoNote | ExternalReplyVoice | ExternalReplyContact | ExternalReplyDice | ExternalReplyGame | ExternalReplyGiveaway | ExternalReplyGiveawayWinners | ExternalReplyInvoice | ExternalReplyLocation | ExternalReplyPoll | ExternalReplyVenue; +/** Describes reply parameters for the message that is being sent. */ +export interface ReplyParameters { + /** Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified */ + message_id: number; + /** If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format `@channelusername`) */ + chat_id?: number | string; + /** Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic. */ + allow_sending_without_reply?: boolean; + /** Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message. */ + quote?: string; + /** Mode for parsing entities in the quote. See formatting options for more details. */ + quote_parse_mode?: string; + /** A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode. */ + quote_entities?: MessageEntity[]; + /** Position of the quote in the original message in UTF-16 code units */ + quote_position?: number; +} +/** This object describes the origin of a message. It can be one of + +- MessageOriginUser +- MessageOriginHiddenUser +- MessageOriginChat +- MessageOriginChannel + */ +type MessageOrigin = MessageOriginUser | MessageOriginHiddenUser | MessageOriginChat | MessageOriginChannel; +export interface AbstractMessageOrigin { + /** Type of the message origin */ + type: string; + /** Date the message was sent originally in Unix time */ + date: number; +} +/** The message was originally sent by a known user. */ +export interface MessageOriginUser { + type: "user"; + /** User that sent the message originally */ + sender_user: User; +} +/** The message was originally sent by an unknown user. */ +export interface MessageOriginHiddenUser { + type: "hidden_user"; + /** Name of the user that sent the message originally */ + sender_user_name: string; +} +/** The message was originally sent on behalf of a chat to a group chat. */ +export interface MessageOriginChat { + type: "chat"; + /** Chat that sent the message originally */ + sender_chat: Chat; + /** For messages originally sent by an anonymous chat administrator, original message author signature */ + author_signature?: string; +} +/** The message was originally sent to a channel chat. */ +export interface MessageOriginChannel { + type: "channel"; + /** Channel chat to which the message was originally sent */ + chat: Chat; + /** Unique message identifier inside the chat */ + message_id: number; + /** Signature of the original post author */ + author_signature?: string; +} +/** This object represents one size of a photo or a file / sticker thumbnail. */ +export interface PhotoSize { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Photo width */ + width: number; + /** Photo height */ + height: number; + /** File size in bytes */ + file_size?: number; +} +/** This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). */ +export interface Animation { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Video width as defined by sender */ + width: number; + /** Video height as defined by sender */ + height: number; + /** Duration of the video in seconds as defined by sender */ + duration: number; + /** Animation thumbnail as defined by sender */ + thumbnail?: PhotoSize; + /** Original animation filename as defined by sender */ + file_name?: string; + /** MIME type of the file as defined by sender */ + mime_type?: string; + /** File size in bytes */ + file_size?: number; +} +/** This object represents an audio file to be treated as music by the Telegram clients. */ +export interface Audio { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Duration of the audio in seconds as defined by sender */ + duration: number; + /** Performer of the audio as defined by sender or by audio tags */ + performer?: string; + /** Title of the audio as defined by sender or by audio tags */ + title?: string; + /** Original filename as defined by sender */ + file_name?: string; + /** MIME type of the file as defined by sender */ + mime_type?: string; + /** File size in bytes */ + file_size?: number; + /** Thumbnail of the album cover to which the music file belongs */ + thumbnail?: PhotoSize; +} +/** This object represents a general file (as opposed to photos, voice messages and audio files). */ +export interface Document { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Document thumbnail as defined by sender */ + thumbnail?: PhotoSize; + /** Original filename as defined by sender */ + file_name?: string; + /** MIME type of the file as defined by sender */ + mime_type?: string; + /** File size in bytes */ + file_size?: number; +} +/** This object represents a video file. */ +export interface Video { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Video width as defined by sender */ + width: number; + /** Video height as defined by sender */ + height: number; + /** Duration of the video in seconds as defined by sender */ + duration: number; + /** Video thumbnail */ + thumbnail?: PhotoSize; + /** Original filename as defined by sender */ + file_name?: string; + /** MIME type of the file as defined by sender */ + mime_type?: string; + /** File size in bytes */ + file_size?: number; +} +/** This object represents a video message (available in Telegram apps as of v.4.0). */ +export interface VideoNote { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Video width and height (diameter of the video message) as defined by sender */ + length: number; + /** Duration of the video in seconds as defined by sender */ + duration: number; + /** Video thumbnail */ + thumbnail?: PhotoSize; + /** File size in bytes */ + file_size?: number; +} +/** This object represents a voice note. */ +export interface Voice { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Duration of the audio in seconds as defined by sender */ + duration: number; + /** MIME type of the file as defined by sender */ + mime_type?: string; + /** File size in bytes */ + file_size?: number; +} +/** This object represents a phone contact. */ +export interface Contact { + /** Contact's phone number */ + phone_number: string; + /** Contact's first name */ + first_name: string; + /** Contact's last name */ + last_name?: string; + /** Contact's user identifier in Telegram. */ + user_id?: number; + /** Additional data about the contact in the form of a vCard */ + vcard?: string; +} +/** This object represents an animated emoji that displays a random value. */ +export interface Dice { + /** Emoji on which the dice throw animation is based */ + emoji: string; + /** Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji */ + value: number; +} +/** This object contains information about one answer option in a poll. */ +export interface PollOption { + /** Option text, 1-100 characters */ + text: string; + /** Number of users that voted for this option */ + voter_count: number; +} +/** This object represents an answer of a user in a non-anonymous poll. */ +export interface PollAnswer { + /** Unique poll identifier */ + poll_id: string; + /** The chat that changed the answer to the poll, if the voter is anonymous */ + voter_chat?: Chat; + /** The user, who changed the answer to the poll, if the voter isn't anonymous + * + * For backward compatibility, the field user will contain the user 136817688 (@Channel_Bot) if the voter was a chat + */ + user?: User; + /** 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. */ + option_ids: number[]; +} +/** This object contains information about a poll. */ +export interface Poll { + /** Unique poll identifier */ + id: string; + /** Poll question, 1-300 characters */ + question: string; + /** List of poll options */ + options: PollOption[]; + /** Total number of users that voted in the poll */ + total_voter_count: number; + /** True, if the poll is closed */ + is_closed: boolean; + /** True, if the poll is anonymous */ + is_anonymous: boolean; + /** Poll type, currently can be “regular” or “quiz” */ + type: "regular" | "quiz"; + /** True, if the poll allows multiple answers */ + allows_multiple_answers: boolean; + /** 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */ + correct_option_id?: number; + /** Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */ + explanation?: string; + /** Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */ + explanation_entities?: MessageEntity[]; + /** Amount of time in seconds the poll will be active after creation */ + open_period?: number; + /** Point in time (Unix timestamp) when the poll will be automatically closed */ + close_date?: number; +} +export declare namespace Location { + interface CommonLocation { + /** Longitude as defined by sender */ + longitude: number; + /** Latitude as defined by sender */ + latitude: number; + /** The radius of uncertainty for the location, measured in meters; 0-1500 */ + horizontal_accuracy?: number; + } + interface LiveLocation extends CommonLocation { + /** Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only. */ + live_period: number; + /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */ + heading: number; + /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */ + proximity_alert_radius?: number; + } +} +/** This object represents a point on the map. */ +export type Location = Location.CommonLocation | Location.LiveLocation; +/** This object represents a venue. */ +export interface Venue { + /** Venue location. Can't be a live location */ + location: Location; + /** Name of the venue */ + title: string; + /** Address of the venue */ + address: string; + /** Foursquare identifier of the venue */ + foursquare_id?: string; + /** Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ + foursquare_type?: string; + /** Google Places identifier of the venue */ + google_place_id?: string; + /** Google Places type of the venue. (See supported types.) */ + google_place_type?: string; +} +/** This object represents a message about a forwarded story in the chat. Currently holds no information. */ +export interface Story { + /** Chat that posted the story */ + chat: Chat; + /** Unique identifier for the story in the chat */ + id: number; +} +/** This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. */ +export interface ProximityAlertTriggered { + /** User that triggered the alert */ + traveler: User; + /** User that set the alert */ + watcher: User; + /** The distance between the users */ + distance: number; +} +/** This object represents a service message about a change in auto-delete timer settings. */ +export interface MessageAutoDeleteTimerChanged { + /** New auto-delete time for messages in the chat; in seconds */ + message_auto_delete_time: number; +} +/** This object represents a service message about a user boosting a chat. */ +export interface ChatBoostAdded { + /** Number of boosts added by the user */ + boost_count: number; +} +/** This object represents a service message about a new forum topic created in the chat. */ +export interface ForumTopicCreated { + /** Name of the topic */ + name: string; + /** Color of the topic icon in RGB format */ + icon_color: number; + /** Unique identifier of the custom emoji shown as the topic icon */ + icon_custom_emoji_id?: string; +} +/** This object represents a service message about an edited forum topic. */ +export interface ForumTopicEdited { + /** New name of the topic, if it was edited */ + name?: string; + /** New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed */ + icon_custom_emoji_id?: string; +} +/** This object represents a service message about a forum topic closed in the chat. Currently holds no information. */ +export interface ForumTopicClosed { +} +/** This object represents a service message about a forum topic reopened in the chat. Currently holds no information. */ +export interface ForumTopicReopened { +} +/** This object represents a service message about General forum topic hidden in the chat. Currently holds no information. */ +export interface GeneralForumTopicHidden { +} +/** This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. */ +export interface GeneralForumTopicUnhidden { +} +/** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUsers button. */ +export interface UsersShared { + /** Identifier of the request */ + request_id: number; + /** Identifiers of the shared users. The bot may not have access to the users and could be unable to use these identifiers, unless the users are already known to the bot by some other means. */ + user_ids: number[]; +} +/** This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button. */ +export interface ChatShared { + /** Identifier of the request */ + request_id: number; + /** Identifier of the shared chat. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means. */ + chat_id: number; +} +/** This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link. */ +export interface WriteAccessAllowed { + /** True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess */ + from_request?: boolean; + /** Name of the Web App, if the access was granted when the Web App was launched from a link */ + web_app_name?: string; + /** True, if the access was granted when the bot was added to the attachment or side menu */ + from_attachment_menu?: boolean; +} +/** This object represents a service message about a video chat scheduled in the chat. */ +export interface VideoChatScheduled { + /** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */ + start_date: number; +} +/** This object represents a service message about a video chat started in the chat. Currently holds no information. */ +export interface VideoChatStarted { +} +/** This object represents a service message about a video chat ended in the chat. */ +export interface VideoChatEnded { + /** Video chat duration in seconds */ + duration: number; +} +/** This object represents a service message about new members invited to a video chat. */ +export interface VideoChatParticipantsInvited { + /** New members that were invited to the video chat */ + users: User[]; +} +/** This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. */ +export interface GiveawayCreated { +} +/** This object represents a message about a scheduled giveaway. */ +export interface Giveaway { + /** The list of chats which the user must join to participate in the giveaway */ + chats: Chat[]; + /** Point in time (Unix timestamp) when winners of the giveaway will be selected */ + winners_selection_date: number; + /** The number of users which are supposed to be selected as winners of the giveaway */ + winner_count: number; + /** True, if only users who join the chats after the giveaway started should be eligible to win */ + only_new_members?: true; + /** True, if the list of giveaway winners will be visible to everyone */ + has_public_winners?: true; + /** Description of additional giveaway prize */ + prize_description?: string; + /** A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways. */ + country_codes?: string[]; + /** The number of months the Telegram Premium subscription won from the giveaway will be active for */ + premium_subscription_month_count?: number; +} +/** This object represents a message about the completion of a giveaway with public winners. */ +export interface GiveawayWinners { + /** The chat that created the giveaway */ + chat: Chat; + /** Identifier of the messsage with the giveaway in the chat */ + giveaway_message_id: number; + /** Point in time (Unix timestamp) when winners of the giveaway were selected */ + winners_selection_date: number; + /** Total number of winners in the giveaway */ + winner_count: number; + /** List of up to 100 winners of the giveaway */ + winners: User[]; + /** The number of other chats the user had to join in order to be eligible for the giveaway */ + additional_chat_count?: number; + /** The number of months the Telegram Premium subscription won from the giveaway will be active for */ + premium_subscription_month_count?: number; + /** Number of undistributed prizes */ + unclaimed_prize_count?: number; + /** True, if only users who had joined the chats after the giveaway started were eligible to win */ + only_new_members?: true; + /** True, if the giveaway was canceled because the payment for it was refunded */ + was_refunded?: true; + /** Description of additional giveaway prize */ + prize_description?: string; +} +/** This object represents a service message about the completion of a giveaway without public winners. */ +export interface GiveawayCompleted { + /** Number of winners in the giveaway */ + winner_count: number; + /** Number of undistributed prizes */ + unclaimed_prize_count?: number; + /** Message with the giveaway that was completed, if it wasn't deleted */ + giveaway_message?: Message; +} +/** Describes the options used for link preview generation. */ +export interface LinkPreviewOptions { + /** True, if the link preview is disabled */ + is_disabled?: boolean; + /** URL to use for the link preview. If empty, then the first URL found in the message text will be used */ + url?: string; + /** True, if the media in the link preview is suppposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */ + prefer_small_media?: boolean; + /** True, if the media in the link preview is suppposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */ + prefer_large_media?: boolean; + /** True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text */ + show_above_text?: boolean; +} +/** Describes data sent from a Web App to the bot. */ +export interface WebAppData { + /** The data. Be aware that a bad client can send arbitrary data in this field. */ + data: string; + /** Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */ + button_text: string; +} +/** This object represents a sticker. */ +export interface Sticker { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. */ + type: "regular" | "mask" | "custom_emoji"; + /** Sticker width */ + width: number; + /** Sticker height */ + height: number; + /** True, if the sticker is animated */ + is_animated: boolean; + /** True, if the sticker is a video sticker */ + is_video: boolean; + /** Sticker thumbnail in the .WEBP or .JPG format */ + thumbnail?: PhotoSize; + /** Emoji associated with the sticker */ + emoji?: string; + /** Name of the sticker set to which the sticker belongs */ + set_name?: string; + /** For premium regular stickers, premium animation for the sticker */ + premium_animation?: File; + /** For mask stickers, the position where the mask should be placed */ + mask_position?: MaskPosition; + /** For custom emoji stickers, unique identifier of the custom emoji */ + custom_emoji_id?: string; + /** File size in bytes */ + file_size?: number; +} +/** This object represents a sticker set. */ +export interface StickerSet { + /** Sticker set name */ + name: string; + /** Sticker set title */ + title: string; + /** Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” */ + sticker_type: "regular" | "mask" | "custom_emoji"; + /** True, if the sticker set contains animated stickers */ + is_animated: boolean; + /** True, if the sticker set contains video stickers */ + is_video: boolean; + /** List of all set stickers */ + stickers: Sticker[]; + /** Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */ + thumbnail?: PhotoSize; +} +/** This object describes the position on faces where a mask should be placed by default. */ +export interface MaskPosition { + /** The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. */ + point: "forehead" | "eyes" | "mouth" | "chin"; + /** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */ + x_shift: number; + /** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */ + y_shift: number; + /** Mask scaling coefficient. For example, 2.0 means double size. */ + scale: number; +} +/** This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. */ +export interface Game { + /** Title of the game */ + title: string; + /** Description of the game */ + description: string; + /** Photo that will be displayed in the game message in chats. */ + photo: PhotoSize[]; + /** Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. */ + text: string; + /** Special entities that appear in text, such as usernames, URLs, bot commands, etc. */ + text_entities: MessageEntity[]; + /** Animation that will be displayed in the game message in chats. Upload via BotFather */ + animation: Animation; +} +/** This object represents one row of the high scores table for a game. */ +export interface GameHighScore { + /** Position in high score table for the game */ + position: number; + /** User */ + user: User; + /** Score */ + score: number; +} +export {}; diff --git a/node_modules/@telegraf/types/methods.d.ts b/node_modules/@telegraf/types/methods.d.ts new file mode 100644 index 0000000..1f4497d --- /dev/null +++ b/node_modules/@telegraf/types/methods.d.ts @@ -0,0 +1,1579 @@ +import type { InlineQueryResult, InlineQueryResultsButton } from "./inline.js"; +import type { ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "./markup.js"; +import type { BotCommand, ChatAdministratorRights, ChatFromGetChat, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, File, ForumTopic, ReactionType, UserChatBoosts, UserFromGetMe, UserProfilePhotos, WebhookInfo } from "./manage.js"; +import type { GameHighScore, LinkPreviewOptions, MaskPosition, Message, MessageEntity, MessageId, ParseMode, Poll, ReplyParameters, SentWebAppMessage, Sticker, StickerSet } from "./message.js"; +import type { PassportElementError } from "./passport.js"; +import type { LabeledPrice, ShippingOption } from "./payment.js"; +import type { BotCommandScope, BotDescription, BotName, BotShortDescription, MenuButton } from "./settings.js"; +import type { Update } from "./update.js"; +/** Extracts the parameters of a given method name */ +type Params> = Parameters[M]>; +/** Utility type providing the argument type for the given method name or `{}` if the method does not take any parameters */ +export type Opts = { + [M in keyof ApiMethods]: Params[0] extends undefined ? {} : NonNullable[0]>; +}; +export type Ret = { + [M in keyof ApiMethods]: ReturnType[M]>; +}; +type UnionKeys = T extends T ? keyof T : never; +/** Wrapper type to bundle all methods of the Telegram Bot API */ +export type ApiMethods = { + /** Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects. + + Notes + 1. This method will not work if an outgoing webhook is set up. + 2. In order to avoid getting duplicate updates, recalculate offset after each server response. */ + getUpdates(args?: { + /** Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. */ + offset?: number; + /** Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. */ + limit?: number; + /** Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. */ + timeout?: number; + /** A list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used. + + Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time. */ + allowed_updates?: ReadonlyArray, "update_id">>; + }): Update[]; + /** Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. + + If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content. + + Notes + 1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. + 2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. + 3. Ports currently supported for Webhooks: 443, 80, 88, 8443. + + If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks. */ + setWebhook(args: { + /** HTTPS URL to send updates to. Use an empty string to remove webhook integration */ + url: string; + /** Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details. */ + certificate?: F; + /** The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS */ + ip_address?: string; + /** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput. */ + max_connections?: number; + /** A list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used. + + Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time. */ + allowed_updates?: ReadonlyArray, "update_id">>; + /** Pass True to drop all pending updates */ + drop_pending_updates?: boolean; + /** A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. */ + secret_token?: string; + }): true; + /** Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. */ + deleteWebhook(args?: { + /** Pass True to drop all pending updates */ + drop_pending_updates?: boolean; + }): true; + /** Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. */ + getWebhookInfo(): WebhookInfo; + /** A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object. */ + getMe(): UserFromGetMe; + /** Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters. */ + logOut(): true; + /** Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters. */ + close(): true; + /** Use this method to send text messages. On success, the sent Message is returned. */ + sendMessage(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Text of the message to be sent, 1-4096 characters after entities parsing */ + text: string; + /** Mode for parsing entities in the message text. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in message text, which can be specified instead of parse_mode */ + entities?: MessageEntity[]; + /** Link preview generation options for the message */ + link_preview_options?: LinkPreviewOptions; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.TextMessage; + /** Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned. */ + forwardMessage(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`) */ + from_chat_id: number | string; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the forwarded message from forwarding and saving */ + protect_content?: boolean; + /** Message identifier in the chat specified in from_chat_id */ + message_id: number; + }): Message; + /** Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned. */ + forwardMessages(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Unique identifier for the chat where the original messages were sent (or channel username in the format `@channelusername`) */ + from_chat_id: number | string; + /** Identifiers of 1-100 messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order. */ + message_ids: number[]; + /** Sends the messages silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the forwarded messages from forwarding and saving */ + protect_content?: boolean; + }): MessageId[]; + /** Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. */ + copyMessage(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`) */ + from_chat_id: number | string; + /** Message identifier in the chat specified in from_chat_id */ + message_id: number; + /** New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept */ + caption?: string; + /** Mode for parsing entities in the new caption. See formatting options for more details. */ + parse_mode?: string; + /** A list of special entities that appear in the new caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): MessageId; + /** Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned. */ + copyMessages(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Unique identifier for the chat where the original messages were sent (or channel username in the format `@channelusername`) */ + from_chat_id: number | string; + /** Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order. */ + message_ids: number[]; + /** Sends the messages silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent messages from forwarding and saving */ + protect_content?: boolean; + /** Pass True to copy the messages without their captions */ + remove_caption?: boolean; + }): MessageId[]; + /** Use this method to send photos. On success, the sent Message is returned. */ + sendPhoto(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. */ + photo: F | string; + /** Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the photo caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Pass True if the photo needs to be covered with a spoiler animation */ + has_spoiler?: boolean; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.PhotoMessage; + /** Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. + + For sending voice messages, use the sendVoice method instead. */ + sendAudio(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. */ + audio: F | string; + /** Audio caption, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the audio caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Duration of the audio in seconds */ + duration?: number; + /** Performer */ + performer?: string; + /** Track name */ + title?: string; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.AudioMessage; + /** Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. */ + sendDocument(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. */ + document: F | string; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the document caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always true, if the document is sent as part of an album. */ + disable_content_type_detection?: boolean; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.DocumentMessage; + /** Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. */ + sendVideo(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. */ + video: F | string; + /** Duration of sent video in seconds */ + duration?: number; + /** Video width */ + width?: number; + /** Video height */ + height?: number; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the video caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Pass True if the video needs to be covered with a spoiler animation */ + has_spoiler?: boolean; + /** Pass True if the uploaded video is suitable for streaming */ + supports_streaming?: boolean; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.VideoMessage; + /** Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. */ + sendAnimation(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. */ + animation: F | string; + /** Duration of sent animation in seconds */ + duration?: number; + /** Animation width */ + width?: number; + /** Animation height */ + height?: number; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the animation caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Pass True if the animation needs to be covered with a spoiler animation */ + has_spoiler?: boolean; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.AnimationMessage; + /** Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. */ + sendVoice(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. */ + voice: F | string; + /** Voice message caption, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the voice message caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Duration of the voice message in seconds */ + duration?: number; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.VoiceMessage; + /** Use this method to send video messages. On success, the sent Message is returned. + As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. */ + sendVideoNote(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data.. Sending video notes by a URL is currently unsupported */ + video_note: F | string; + /** Duration of sent video in seconds */ + duration?: number; + /** Video width and height, i.e. diameter of the video message */ + length?: number; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.VideoNoteMessage; + /** Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned. */ + sendMediaGroup(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** An array describing messages to be sent, must include 2-10 items */ + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + media: ReadonlyArray | InputMediaDocument | InputMediaPhoto | InputMediaVideo>; + /** Sends the messages silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent messages from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + }): Array; + /** Use this method to send point on the map. On success, the sent Message is returned. */ + sendLocation(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Latitude of the location */ + latitude: number; + /** Longitude of the location */ + longitude: number; + /** The radius of uncertainty for the location, measured in meters; 0-1500 */ + horizontal_accuracy?: number; + /** Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400. */ + live_period?: number; + /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */ + heading?: number; + /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */ + proximity_alert_radius?: number; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.LocationMessage; + /** Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */ + editMessageLiveLocation(args: { + /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id?: number | string; + /** Required if inline_message_id is not specified. Identifier of the message to edit */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + /** Latitude of new location */ + latitude: number; + /** Longitude of new location */ + longitude: number; + /** The radius of uncertainty for the location, measured in meters; 0-1500 */ + horizontal_accuracy?: number; + /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */ + heading?: number; + /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */ + proximity_alert_radius?: number; + /** An object for a new inline keyboard. */ + reply_markup?: InlineKeyboardMarkup; + }): (Update.Edited & Message.LocationMessage) | true; + /** Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned. */ + stopMessageLiveLocation(args: { + /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id?: number | string; + /** Required if inline_message_id is not specified. Identifier of the message with live location to stop */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + /** An object for a new inline keyboard. */ + reply_markup?: InlineKeyboardMarkup; + }): (Update.Edited & Message.LocationMessage) | true; + /** Use this method to send information about a venue. On success, the sent Message is returned. */ + sendVenue(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Latitude of the venue */ + latitude: number; + /** Longitude of the venue */ + longitude: number; + /** Name of the venue */ + title: string; + /** Address of the venue */ + address: string; + /** Foursquare identifier of the venue */ + foursquare_id?: string; + /** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ + foursquare_type?: string; + /** Google Places identifier of the venue */ + google_place_id?: string; + /** Google Places type of the venue. (See supported types.) */ + google_place_type?: string; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.VenueMessage; + /** Use this method to send phone contacts. On success, the sent Message is returned. */ + sendContact(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Contact's phone number */ + phone_number: string; + /** Contact's first name */ + first_name: string; + /** Contact's last name */ + last_name?: string; + /** Additional data about the contact in the form of a vCard, 0-2048 bytes */ + vcard?: string; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.ContactMessage; + /** Use this method to send a native poll. On success, the sent Message is returned. */ + sendPoll(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Poll question, 1-300 characters */ + question: string; + /** A list of answer options, 2-10 strings 1-100 characters each */ + options: readonly string[]; + /** True, if the poll needs to be anonymous, defaults to True */ + is_anonymous?: boolean; + /** Poll type, “quiz” or “regular”, defaults to “regular” */ + type?: "quiz" | "regular"; + /** True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False */ + allows_multiple_answers?: boolean; + /** 0-based identifier of the correct answer option, required for polls in quiz mode */ + correct_option_id?: number; + /** Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing */ + explanation?: string; + /** Mode for parsing entities in the explanation. See formatting options for more details. */ + explanation_parse_mode?: ParseMode; + /** A list of special entities that appear in the poll explanation, which can be specified instead of parse_mode */ + explanation_entities?: MessageEntity[]; + /** Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. */ + open_period?: number; + /** Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period. */ + close_date?: number; + /** Pass True if the poll needs to be immediately closed. This can be useful for poll preview. */ + is_closed?: boolean; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.PollMessage; + /** Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. */ + sendDice(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Emoji on which the dice throw animation is based. Currently, must be one of "🎲", "🎯", "🏀", "⚽", "🎳", or "🎰". Dice can have values 1-6 for "🎲", "🎯" and "🎳", values 1-5 for "🏀" and "⚽", and values 1-64 for "🎰". Defaults to "🎲" */ + emoji?: string; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.DiceMessage; + /** Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. + + Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of "Retrieving image, please wait...", the bot may use sendChatAction with action = upload_photo. The user will see a "sending photo" status for the bot. + + We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. */ + sendChatAction(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes. */ + action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note"; + /** Unique identifier for the target message thread; supergroups only */ + message_thread_id?: number; + }): true; + /** Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. In albums, bots must react to the first message. Returns True on success. */ + setMessageReaction(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Identifier of the target message */ + message_id: number; + /** New list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. */ + reaction?: ReactionType[]; + /** Pass True to set the reaction with a big animation */ + is_big?: Boolean; + }): true; + /** Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. */ + getUserProfilePhotos(args: { + /** Unique identifier of the target user */ + user_id: number; + /** Sequential number of the first photo to be returned. By default, all photos are returned. */ + offset?: number; + /** Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. */ + limit?: number; + }): UserProfilePhotos; + /** Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot/, where is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. + + Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received. */ + getFile(args: { + /** File identifier to get information about */ + file_id: string; + }): File; + /** Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. + * @deprecated Use `banChatMember` instead. */ + kickChatMember: ApiMethods["banChatMember"]; + /** Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */ + banChatMember(args: { + /** Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + /** Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. */ + until_date?: number; + /** Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels. */ + revoke_messages?: boolean; + }): true; + /** Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success. */ + unbanChatMember(args: { + /** Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + /** Do nothing if the user is not banned */ + only_if_banned?: boolean; + }): true; + /** Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success. */ + restrictChatMember(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + /** An object for new user permissions */ + permissions: ChatPermissions; + /** Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. */ + use_independent_chat_permissions?: boolean; + /** Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever */ + until_date?: number; + }): true; + /** Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success. */ + promoteChatMember(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + /** Pass True if the administrator's presence in the chat is hidden */ + is_anonymous?: boolean; + /** Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege */ + can_manage_chat?: boolean; + /** Pass True if the administrator can create channel posts, channels only */ + can_post_messages?: boolean; + /** Pass True if the administrator can edit messages of other users and can pin messages, channels only */ + can_edit_messages?: boolean; + /** Pass True if the administrator can delete messages of other users */ + can_delete_messages?: boolean; + /** Pass True if the administrator can manage video chats */ + can_manage_video_chats?: boolean; + /** Pass True if the administrator can restrict, ban or unban chat members */ + can_restrict_members?: boolean; + /** Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him) */ + can_promote_members?: boolean; + /** Pass True if the administrator can change chat title, photo and other settings */ + can_change_info?: boolean; + /** Pass True if the administrator can invite new users to the chat */ + can_invite_users?: boolean; + /** Pass True if the administrator can pin messages, supergroups only */ + can_pin_messages?: boolean; + /** Pass True if the administrator can post stories to the chat */ + can_post_stories?: boolean; + /** Pass True if the administrator can edit stories posted by other users */ + can_edit_stories?: boolean; + /** Pass True if the administrator can delete stories posted by other users */ + can_delete_stories?: boolean; + /** Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only */ + can_manage_topics?: boolean; + }): true; + /** Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success. */ + setChatAdministratorCustomTitle(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + /** New custom title for the administrator; 0-16 characters, emoji are not allowed */ + custom_title: string; + }): true; + /** Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success. */ + banChatSenderChat(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target sender chat */ + sender_chat_id: number; + }): true; + /** Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success. */ + unbanChatSenderChat(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target sender chat */ + sender_chat_id: number; + }): true; + /** Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success. */ + setChatPermissions(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** An object for new default chat permissions */ + permissions: ChatPermissions; + /** Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. */ + use_independent_chat_permissions?: boolean; + }): true; + /** Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success. + + Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink or by calling the getChat method. If your bot needs to generate a new primary invite link replacing its previous one, use exportChatInviteLink again. */ + exportChatInviteLink(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + }): string; + /** Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object. */ + createChatInviteLink(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Invite link name; 0-32 characters */ + name?: string; + /** Point in time (Unix timestamp) when the link will expire */ + expire_date?: number; + /** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */ + member_limit?: number; + /** True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified */ + creates_join_request?: boolean; + }): ChatInviteLink; + /** Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object. */ + editChatInviteLink(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** The invite link to edit */ + invite_link: string; + /** Invite link name; 0-32 characters */ + name?: string; + /** Point in time (Unix timestamp) when the link will expire */ + expire_date?: number; + /** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */ + member_limit?: number; + /** True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified */ + creates_join_request?: boolean; + }): ChatInviteLink; + /** Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object. */ + revokeChatInviteLink(args: { + /** Unique identifier of the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** The invite link to revoke */ + invite_link: string; + }): ChatInviteLink; + /** Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success. */ + approveChatJoinRequest(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + }): true; + /** Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success. */ + declineChatJoinRequest(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + }): true; + /** Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */ + setChatPhoto(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** New chat photo, uploaded using multipart/form-data */ + photo: F; + }): true; + /** Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */ + deleteChatPhoto(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + }): true; + /** Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */ + setChatTitle(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** New chat title, 1-128 characters */ + title: string; + }): true; + /** Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */ + setChatDescription(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** New chat description, 0-255 characters */ + description?: string; + }): true; + /** Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns True on success. */ + pinChatMessage(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Identifier of a message to pin */ + message_id: number; + /** Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats. */ + disable_notification?: boolean; + }): true; + /** Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns True on success. */ + unpinChatMessage(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned. */ + message_id?: number; + }): true; + /** Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns True on success. */ + unpinAllChatMessages(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + }): true; + /** Use this method for your bot to leave a group, supergroup or channel. Returns True on success. */ + leaveChat(args: { + /** Unique identifier for the target chat or username of the target supergroup or channel (in the format `@channelusername`) */ + chat_id: number | string; + }): true; + /** Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. */ + getChat(args: { + /** Unique identifier for the target chat or username of the target supergroup or channel (in the format `@channelusername`) */ + chat_id: number | string; + }): ChatFromGetChat; + /** Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects. */ + getChatAdministrators(args: { + /** Unique identifier for the target chat or username of the target supergroup or channel (in the format `@channelusername`) */ + chat_id: number | string; + }): Array; + /** Use this method to get the number of members in a chat. Returns Int on success. + * @deprecated Use `getChatMemberCount` instead. */ + getChatMembersCount: ApiMethods["getChatMemberCount"]; + /** Use this method to get the number of members in a chat. Returns Int on success. */ + getChatMemberCount(args: { + /** Unique identifier for the target chat or username of the target supergroup or channel (in the format `@channelusername`) */ + chat_id: number | string; + }): number; + /** Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success. */ + getChatMember(args: { + /** Unique identifier for the target chat or username of the target supergroup or channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + }): ChatMember; + /** Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set ly returned in getChat requests to check if the bot can use this method. Returns True on success. */ + setChatStickerSet(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Name of the sticker set to be set as the group sticker set */ + sticker_set_name: string; + }): true; + /** Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set ly returned in getChat requests to check if the bot can use this method. Returns True on success. */ + deleteChatStickerSet(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + }): true; + /** Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects. */ + getForumTopicIconStickers(): Sticker[]; + /** Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object. */ + createForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Topic name, 1-128 characters */ + name: string; + /** Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F) */ + icon_color?: 0x6FB9F0 | 0xFFD67E | 0xCB86DB | 0x8EEE98 | 0xFF93B2 | 0xFB6F5F; + /** Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. */ + icon_custom_emoji_id?: string; + }): ForumTopic; + /** Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. */ + editForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier for the target message thread of the forum topic */ + message_thread_id: number; + /** New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept */ + name?: string; + /** New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept */ + icon_custom_emoji_id?: string; + }): true; + /** Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. */ + closeForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier for the target message thread of the forum topic */ + message_thread_id: number; + }): true; + /** Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. */ + reopenForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier for the target message thread of the forum topic */ + message_thread_id: number; + }): true; + /** Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success. */ + deleteForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier for the target message thread of the forum topic */ + message_thread_id: number; + }): true; + /** Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. */ + unpinAllForumTopicMessages(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier for the target message thread of the forum topic */ + message_thread_id: number; + }): true; + /** Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success. */ + editGeneralForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** New topic name, 1-128 characters */ + name: string; + }): true; + /** Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. */ + closeGeneralForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + }): true; + /** Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success. */ + reopenGeneralForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + }): true; + /** Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success. */ + hideGeneralForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + }): true; + /** Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. */ + unhideGeneralForumTopic(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + }): true; + /** Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. */ + unpinAllGeneralForumTopicMessages(args: { + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + }): true; + /** Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. + + Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. */ + answerCallbackQuery(args: { + /** Unique identifier for the query to be answered */ + callback_query_id: string; + /** Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters */ + text?: string; + /** If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. */ + show_alert?: boolean; + /** URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button. + + Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. */ + url?: string; + /** The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. */ + cache_time?: number; + }): true; + /** Use this method to change the bot's name. Returns True on success. */ + setMyName(args: { + /** New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language. */ + name?: string; + /** A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name. */ + language_code?: string; + }): true; + /** Use this method to get the current bot name for the given user language. Returns BotName on success. */ + getMyName(args: { + /** A two-letter ISO 639-1 language code or an empty string */ + language_code?: string; + }): BotName; + /** Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object. */ + getUserChatBoosts(arg: { + /** Unique identifier for the chat or username of the channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; + }): UserChatBoosts[]; + /** Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success. */ + setMyCommands(args: { + /** A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. */ + commands: readonly BotCommand[]; + /** An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. */ + scope?: BotCommandScope; + /** A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands */ + language_code?: string; + }): true; + /** Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success. */ + deleteMyCommands(args: { + /** An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. */ + scope?: BotCommandScope; + /** A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands */ + language_code?: string; + }): true; + /** Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned. */ + getMyCommands(args: { + /** An object, describing scope of users. Defaults to BotCommandScopeDefault. */ + scope?: BotCommandScope; + /** A two-letter ISO 639-1 language code or an empty string */ + language_code?: string; + }): BotCommand[]; + /** Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success. */ + setMyDescription(args: { + /** New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language. */ + description?: string; + /** A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. */ + language_code?: string; + }): true; + /** Use this method to get the current bot description for the given user language. Returns BotDescription on success. */ + getMyDescription(args: { + /** A two-letter ISO 639-1 language code or an empty string */ + language_code?: string; + }): BotDescription; + /** Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success. */ + setMyShortDescription(args: { + /** New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language. */ + short_description?: string; + /** A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description. */ + language_code?: string; + }): true; + /** Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success. */ + getMyShortDescription(args: { + /** A two-letter ISO 639-1 language code or an empty string */ + language_code?: string; + }): BotShortDescription; + /** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success. */ + setChatMenuButton(args: { + /** Unique identifier for the target private chat. If not specified, default bot's menu button will be changed */ + chat_id?: number; + /** An object for the bot's new menu button. Defaults to MenuButtonDefault */ + menu_button?: MenuButton; + }): true; + /** Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success. */ + getChatMenuButton(args: { + /** Unique identifier for the target private chat. If not specified, default bot's menu button will be returned */ + chat_id?: number; + }): MenuButton; + /** Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success. */ + setMyDefaultAdministratorRights(args: { + /** An object describing new default administrator rights. If not specified, the default administrator rights will be cleared. */ + rights?: ChatAdministratorRights; + /** Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed. */ + for_channels?: boolean; + }): true; + /** Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success. */ + getMyDefaultAdministratorRights(args: { + /** Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned. */ + for_channels?: boolean; + }): ChatAdministratorRights; + /** Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */ + editMessageText(args: { + /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id?: number | string; + /** Required if inline_message_id is not specified. Identifier of the message to edit */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + /** New text of the message, 1-4096 characters after entities parsing */ + text: string; + /** Mode for parsing entities in the message text. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in message text, which can be specified instead of parse_mode */ + entities?: MessageEntity[]; + /** Link preview generation options for the message */ + link_preview_options?: LinkPreviewOptions; + /** An object for an inline keyboard. */ + reply_markup?: InlineKeyboardMarkup; + }): (Update.Edited & Message.TextMessage) | true; + /** Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */ + editMessageCaption(args: { + /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id?: number | string; + /** Required if inline_message_id is not specified. Identifier of the message to edit */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + /** New caption of the message, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the message caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** An object for an inline keyboard. */ + reply_markup?: InlineKeyboardMarkup; + }): (Update.Edited & Message.CaptionableMessage) | true; + /** Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */ + editMessageMedia(args: { + /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id?: number | string; + /** Required if inline_message_id is not specified. Identifier of the message to edit */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + /** An object for a new media content of the message */ + media: InputMedia; + /** An object for a new inline keyboard. */ + reply_markup?: InlineKeyboardMarkup; + }): (Update.Edited & Message) | true; + /** Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */ + editMessageReplyMarkup(args: { + /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id?: number | string; + /** Required if inline_message_id is not specified. Identifier of the message to edit */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + /** An object for an inline keyboard. */ + reply_markup?: InlineKeyboardMarkup; + }): (Update.Edited & Message) | true; + /** Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned. */ + stopPoll(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Identifier of the original message with the poll */ + message_id: number; + /** An object for a new message inline keyboard. */ + reply_markup?: InlineKeyboardMarkup; + }): Poll; + /** Use this method to delete a message, including service messages, with the following limitations: + - A message can only be deleted if it was sent less than 48 hours ago. + - Service messages about a supergroup, channel, or forum topic creation can't be deleted. + - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. + - Bots can delete outgoing messages in private chats, groups, and supergroups. + - Bots can delete incoming messages in private chats. + - Bots granted can_post_messages permissions can delete outgoing messages in channels. + - If the bot is an administrator of a group, it can delete any message there. + - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there. + Returns True on success. */ + deleteMessage(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Identifier of the message to delete */ + message_id: number; + }): true; + /** Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success. */ + deleteMessages(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Identifiers of 1-100 messages to delete. See {@link ApiMethods.deleteMessage deleteMessage} for limitations on which messages can be deleted */ + message_ids: number[]; + }): true; + /** Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned. */ + sendSticker(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP or .TGS sticker using multipart/form-data. Video stickers can only be sent by a file_id. Animated stickers can't be sent via an HTTP URL. */ + sticker: F | string; + /** Emoji associated with the sticker; only for just uploaded stickers */ + emoji?: string; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply; + }): Message.StickerMessage; + /** Use this method to get a sticker set. On success, a StickerSet object is returned. */ + getStickerSet(args: { + /** Name of the sticker set */ + name: string; + }): StickerSet; + /** Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects. */ + getCustomEmojiStickers(args: { + /** List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. */ + custom_emoji_ids: string[]; + }): Sticker[]; + /** Use this method to upload a file with a sticker for later use in the createNewStickerSet and addStickerToSet methods (the file can be used multiple times). Returns the uploaded File on success. */ + uploadStickerFile(args: { + /** User identifier of sticker file owner */ + user_id: number; + /** Format of the sticker, must be one of “static”, “animated”, “video” */ + sticker_format: "static" | "animated" | "video"; + /** A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. */ + sticker: F; + }): File; + /** Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success. */ + createNewStickerSet(args: { + /** User identifier of created sticker set owner */ + user_id: number; + /** Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_". is case insensitive. 1-64 characters. */ + name: string; + /** Sticker set title, 1-64 characters */ + title: string; + /** A list of 1-50 initial stickers to be added to the sticker set */ + stickers: InputSticker[]; + /** Format of the sticker, must be one of “static”, “animated”, “video” */ + sticker_format: "static" | "animated" | "video"; + /** Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created. */ + sticker_type?: "regular" | "mask" | "custom_emoji"; + /** Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only */ + needs_repainting?: boolean; + }): true; + /** Use this method to add a new sticker to a set created by the bot. The format of the added sticker must match the format of the other stickers in the set. Emoji sticker sets can have up to 200 stickers. Animated and video sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success. */ + addStickerToSet(args: { + /** User identifier of sticker set owner */ + user_id: number; + /** Sticker set name */ + name: string; + /** An object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed. */ + sticker: InputSticker; + }): true; + /** Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success. */ + setStickerPositionInSet(args: { + /** File identifier of the sticker */ + sticker: string; + /** New sticker position in the set, zero-based */ + position: number; + }): true; + /** Use this method to delete a sticker from a set created by the bot. Returns True on success. */ + deleteStickerFromSet(args: { + /** File identifier of the sticker */ + sticker: string; + }): true; + /** Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success. */ + setStickerEmojiList(args: { + /** File identifier of the sticker */ + sticker: string; + /** A list of 1-20 emoji associated with the sticker */ + emoji_list: string[]; + }): true; + /** Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success. */ + setStickerKeywords(args: { + /** File identifier of the sticker */ + sticker: string; + /** A list of 0-20 search keywords for the sticker with total length of up to 64 characters */ + keywords?: string[]; + }): true; + /** Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success. */ + setStickerMaskPosition(args: { + /** File identifier of the sticker */ + sticker: string; + /** An object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position. */ + mask_position?: MaskPosition; + }): true; + /** Use this method to set the title of a created sticker set. Returns True on success. */ + setStickerSetTitle(args: { + /** Sticker set name */ + name: string; + /** Sticker set title, 1-64 characters */ + title: string; + }): true; + /** Use this method to delete a sticker set that was created by the bot. Returns True on success. */ + deleteStickerSet(args: { + /** Sticker set name */ + name: string; + }): true; + /** Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success. */ + setStickerSetThumbnail(args: { + /** Sticker set name */ + name: string; + /** User identifier of the sticker set owner */ + user_id: number; + /** A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. */ + thumbnail?: F | string; + }): true; + /** Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success. */ + setCustomEmojiStickerSetThumbnail(args: { + /** Sticker set name */ + name: string; + /** Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail. */ + custom_emoji_id?: string; + }): true; + /** Use this method to send answers to an inline query. On success, True is returned. + No more than 50 results per query are allowed. + + Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities. */ + answerInlineQuery(args: { + /** Unique identifier for the answered query */ + inline_query_id: string; + /** An array of results for the inline query */ + results: readonly InlineQueryResult[]; + /** The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. */ + cache_time?: number; + /** Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. */ + is_personal?: boolean; + /** Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. */ + next_offset?: string; + /** An object describing a button to be shown above inline query results */ + button?: InlineQueryResultsButton; + }): true; + /** Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned. */ + answerWebAppQuery(args: { + /** Unique identifier for the query to be answered */ + web_app_query_id: string; + /** An object describing the message to be sent */ + result: InlineQueryResult; + }): SentWebAppMessage; + /** Use this method to send invoices. On success, the sent Message is returned. */ + sendInvoice(args: { + /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ + chat_id: number | string; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Product name, 1-32 characters */ + title: string; + /** Product description, 1-255 characters */ + description: string; + /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */ + payload: string; + /** Payment provider token, obtained via @BotFather */ + provider_token: string; + /** Three-letter ISO 4217 currency code, see more on currencies */ + currency: string; + /** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */ + prices: readonly LabeledPrice[]; + /** The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */ + max_tip_amount?: number; + /** An array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */ + suggested_tip_amounts?: number[]; + /** Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter */ + start_parameter?: string; + /** Data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. */ + provider_data?: string; + /** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. */ + photo_url?: string; + /** Photo size in bytes */ + photo_size?: number; + /** Photo width */ + photo_width?: number; + /** Photo height */ + photo_height?: number; + /** Pass True if you require the user's full name to complete the order */ + need_name?: boolean; + /** Pass True if you require the user's phone number to complete the order */ + need_phone_number?: boolean; + /** Pass True if you require the user's email address to complete the order */ + need_email?: boolean; + /** Pass True if you require the user's shipping address to complete the order */ + need_shipping_address?: boolean; + /** Pass True if the user's phone number should be sent to provider */ + send_phone_number_to_provider?: boolean; + /** Pass True if the user's email address should be sent to provider */ + send_email_to_provider?: boolean; + /** Pass True if the final price depends on the shipping method */ + is_flexible?: boolean; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** An object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. */ + reply_markup?: InlineKeyboardMarkup; + }): Message.InvoiceMessage; + /** Use this method to create a link for an invoice. Returns the created invoice link as String on success. */ + createInvoiceLink(args: { + /** Product name, 1-32 characters */ + title: string; + /** Product description, 1-255 characters */ + description: string; + /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */ + payload: string; + /** Payment provider token, obtained via BotFather */ + provider_token: string; + /** Three-letter ISO 4217 currency code, see more on currencies */ + currency: string; + /** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */ + prices: LabeledPrice[]; + /** The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */ + max_tip_amount?: number; + /** An array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */ + suggested_tip_amounts?: number[]; + /** Data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. */ + provider_data?: string; + /** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. */ + photo_url?: string; + /** Photo size in bytes */ + photo_size?: number; + /** Photo width */ + photo_width?: number; + /** Photo height */ + photo_height?: number; + /** Pass True if you require the user's full name to complete the order */ + need_name?: boolean; + /** Pass True if you require the user's phone number to complete the order */ + need_phone_number?: boolean; + /** Pass True if you require the user's email address to complete the order */ + need_email?: boolean; + /** Pass True if you require the user's shipping address to complete the order */ + need_shipping_address?: boolean; + /** Pass True if the user's phone number should be sent to the provider */ + send_phone_number_to_provider?: boolean; + /** Pass True if the user's email address should be sent to the provider */ + send_email_to_provider?: boolean; + /** Pass True if the final price depends on the shipping method */ + is_flexible?: boolean; + }): string; + /** If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned. */ + answerShippingQuery(args: { + /** Unique identifier for the query to be answered */ + shipping_query_id: string; + /** Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible) */ + ok: boolean; + /** Required if ok is True. An array of available shipping options. */ + shipping_options?: readonly ShippingOption[]; + /** Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. */ + error_message?: string; + }): true; + /** Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. */ + answerPreCheckoutQuery(args: { + /** Unique identifier for the query to be answered */ + pre_checkout_query_id: string; + /** Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. */ + ok: boolean; + /** Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. */ + error_message?: string; + }): true; + /** Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. + + Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. */ + setPassportDataErrors(args: { + /** User identifier */ + user_id: number; + /** An array describing the errors */ + errors: readonly PassportElementError[]; + }): true; + /** Use this method to send a game. On success, the sent Message is returned. */ + sendGame(args: { + /** Unique identifier for the target chat */ + chat_id: number; + /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ + message_thread_id?: number; + /** Short name of the game, serves as the unique identifier for the game. Set up your games via BotFather. */ + game_short_name: string; + /** Sends the message silently. Users will receive a notification with no sound. */ + disable_notification?: boolean; + /** Protects the contents of the sent message from forwarding and saving */ + protect_content?: boolean; + /** Description of the message to reply to */ + reply_parameters?: ReplyParameters; + /** An object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. */ + reply_markup?: InlineKeyboardMarkup; + }): Message.GameMessage; + /** Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. */ + setGameScore(args: { + /** User identifier */ + user_id: number; + /** New score, must be non-negative */ + score: number; + /** Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters */ + force?: boolean; + /** Pass True if the game message should not be automatically edited to include the current scoreboard */ + disable_edit_message?: boolean; + /** Required if inline_message_id is not specified. Unique identifier for the target chat */ + chat_id?: number; + /** Required if inline_message_id is not specified. Identifier of the sent message */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + }): (Update.Edited & Message.GameMessage) | true; + /** Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects. + + This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change. */ + getGameHighScores(args: { + /** Target user id */ + user_id: number; + /** Required if inline_message_id is not specified. Unique identifier for the target chat */ + chat_id?: number; + /** Required if inline_message_id is not specified. Identifier of the sent message */ + message_id?: number; + /** Required if chat_id and message_id are not specified. Identifier of the inline message */ + inline_message_id?: string; + }): GameHighScore[]; +}; +/** This object describes a sticker to be added to a sticker set. */ +export interface InputSticker { + /** The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. Animated and video stickers can't be uploaded via HTTP URL. */ + sticker: F | string; + /** List of 1-20 emoji associated with the sticker */ + emoji_list: string[]; + /** Position where the mask should be placed on faces. For “mask” stickers only. */ + mask_position?: MaskPosition; + /** List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only. */ + keywords?: string[]; +} +/** This object represents the content of a media message to be sent. It should be one of + - InputMediaAnimation + - InputMediaDocument + - InputMediaAudio + - InputMediaPhoto + - InputMediaVideo */ +export type InputMedia = InputMediaAnimation | InputMediaDocument | InputMediaAudio | InputMediaPhoto | InputMediaVideo; +/** Represents a photo to be sent. */ +export interface InputMediaPhoto { + /** Type of the result, must be photo */ + type: "photo"; + /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name. */ + media: F | string; + /** Caption of the photo to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the photo caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Pass True if the photo needs to be covered with a spoiler animation */ + has_spoiler?: boolean; +} +/** Represents a video to be sent. */ +export interface InputMediaVideo { + /** Type of the result, must be video */ + type: "video"; + /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name. */ + media: F | string; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Caption of the video to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the video caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Video width */ + width?: number; + /** Video height */ + height?: number; + /** Video duration in seconds */ + duration?: number; + /** Pass True if the uploaded video is suitable for streaming */ + supports_streaming?: boolean; + /** Pass True if the photo needs to be covered with a spoiler animation */ + has_spoiler?: boolean; +} +/** Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. */ +export interface InputMediaAnimation { + /** Type of the result, must be animation */ + type: "animation"; + /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name. */ + media: F | string; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Caption of the animation to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the animation caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Animation width */ + width?: number; + /** Animation height */ + height?: number; + /** Animation duration in seconds */ + duration?: number; + /** Pass True if the photo needs to be covered with a spoiler animation */ + has_spoiler?: boolean; +} +/** Represents an audio file to be treated as music to be sent. */ +export interface InputMediaAudio { + /** Type of the result, must be audio */ + type: "audio"; + /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name. */ + media: F | string; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Caption of the audio to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the audio caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Duration of the audio in seconds */ + duration?: number; + /** Performer of the audio */ + performer?: string; + /** Title of the audio */ + title?: string; +} +/** Represents a general file to be sent. */ +export interface InputMediaDocument { + /** Type of the result, must be document */ + type: "document"; + /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name. */ + media: F | string; + /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://" if the thumbnail was uploaded using multipart/form-data under . */ + thumbnail?: F; + /** Caption of the document to be sent, 0-1024 characters after entities parsing */ + caption?: string; + /** Mode for parsing entities in the document caption. See formatting options for more details. */ + parse_mode?: ParseMode; + /** List of special entities that appear in the caption, which can be specified instead of parse_mode */ + caption_entities?: MessageEntity[]; + /** Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always true, if the document is sent as part of an album. */ + disable_content_type_detection?: boolean; +} +export {}; diff --git a/node_modules/@telegraf/types/package.json b/node_modules/@telegraf/types/package.json new file mode 100644 index 0000000..a02eae1 --- /dev/null +++ b/node_modules/@telegraf/types/package.json @@ -0,0 +1,36 @@ +{ + "name": "@telegraf/types", + "private": false, + "version": "7.1.0", + "description": "Type declarations for the Telegram API", + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/telegraf/types.git" + }, + "keywords": [ + "telegram", + "telegraf", + "bot", + "api", + "types", + "typings" + ], + "scripts": { + "prepare": "deno task backport" + }, + "author": "Telegraf contributors", + "types": "index.d.ts", + "license": "MIT", + "bugs": { + "url": "https://github.com/telegraf/types/issues" + }, + "homepage": "https://github.com/telegraf/types#readme", + "files": [ + "*.d.ts", + "index.js" + ], + "devDependencies": { + "deno-bin": "^1.40.4" + } +} diff --git a/node_modules/@telegraf/types/passport.d.ts b/node_modules/@telegraf/types/passport.d.ts new file mode 100644 index 0000000..33a8364 --- /dev/null +++ b/node_modules/@telegraf/types/passport.d.ts @@ -0,0 +1,163 @@ +/** Describes Telegram Passport data shared with the bot by the user. */ +export interface PassportData { + /** Array with information about documents and other Telegram Passport elements that was shared with the bot */ + data: EncryptedPassportElement[]; + /** Encrypted credentials required to decrypt the data */ + credentials: EncryptedCredentials; +} +/** This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. */ +export interface PassportFile { + /** Identifier for this file, which can be used to download or reuse the file */ + file_id: string; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + file_unique_id: string; + /** File size in bytes */ + file_size: number; + /** Unix time when the file was uploaded */ + file_date: number; +} +/** Describes documents or other Telegram Passport elements shared with the bot by the user. */ +export interface EncryptedPassportElement { + /** Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. */ + type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration" | "phone_number" | "email"; + /** Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */ + data?: string; + /** User's verified phone number, available only for “phone_number” type */ + phone_number?: string; + /** User's verified email address, available only for “email” type */ + email?: string; + /** Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */ + files?: PassportFile[]; + /** Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ + front_side?: PassportFile; + /** Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ + reverse_side?: PassportFile; + /** Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ + selfie?: PassportFile; + /** Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */ + translation?: PassportFile[]; + /** Base64-encoded element hash for using in PassportElementErrorUnspecified */ + hash: string; +} +/** Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */ +export interface EncryptedCredentials { + /** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */ + data: string; + /** Base64-encoded data hash for data authentication */ + hash: string; + /** Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption */ + secret: string; +} +/** This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of: +- PassportElementErrorDataField +- PassportElementErrorFrontSide +- PassportElementErrorReverseSide +- PassportElementErrorSelfie +- PassportElementErrorFile +- PassportElementErrorFiles +- PassportElementErrorTranslationFile +- PassportElementErrorTranslationFiles +- PassportElementErrorUnspecified +*/ +export type PassportElementError = PassportElementErrorDataField | PassportElementErrorFrontSide | PassportElementErrorReverseSide | PassportElementErrorSelfie | PassportElementErrorFile | PassportElementErrorFiles | PassportElementErrorTranslationFile | PassportElementErrorTranslationFiles | PassportElementErrorUnspecified; +/** Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. */ +export interface PassportElementErrorDataField { + /** Error source, must be data */ + source: "data"; + /** The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” */ + type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address"; + /** Name of the data field which has the error */ + field_name: string; + /** Base64-encoded data hash */ + data_hash: string; + /** Error message */ + message: string; +} +/** Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. */ +export interface PassportElementErrorFrontSide { + /** Error source, must be front_side */ + source: "front_side"; + /** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */ + type: "passport" | "driver_license" | "identity_card" | "internal_passport"; + /** Base64-encoded hash of the file with the front side of the document */ + file_hash: string; + /** Error message */ + message: string; +} +/** Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. */ +export interface PassportElementErrorReverseSide { + /** Error source, must be reverse_side */ + source: "reverse_side"; + /** The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” */ + type: "driver_license" | "identity_card"; + /** Base64-encoded hash of the file with the reverse side of the document */ + file_hash: string; + /** Error message */ + message: string; +} +/** Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. */ +export interface PassportElementErrorSelfie { + /** Error source, must be selfie */ + source: "selfie"; + /** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */ + type: "passport" | "driver_license" | "identity_card" | "internal_passport"; + /** Base64-encoded hash of the file with the selfie */ + file_hash: string; + /** Error message */ + message: string; +} +/** Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. */ +export interface PassportElementErrorFile { + /** Error source, must be file */ + source: "file"; + /** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */ + type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration"; + /** Base64-encoded file hash */ + file_hash: string; + /** Error message */ + message: string; +} +/** Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. */ +export interface PassportElementErrorFiles { + /** Error source, must be files */ + source: "files"; + /** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */ + type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration"; + /** List of base64-encoded file hashes */ + file_hashes: string[]; + /** Error message */ + message: string; +} +/** Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. */ +export interface PassportElementErrorTranslationFile { + /** Error source, must be translation_file */ + source: "translation_file"; + /** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */ + type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration"; + /** Base64-encoded file hash */ + file_hash: string; + /** Error message */ + message: string; +} +/** Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. */ +export interface PassportElementErrorTranslationFiles { + /** Error source, must be translation_files */ + source: "translation_files"; + /** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */ + type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration"; + /** List of base64-encoded file hashes */ + file_hashes: string[]; + /** Error message */ + message: string; +} +/** Represents an issue in an unspecified place. The error is considered resolved when new data is added. */ +export interface PassportElementErrorUnspecified { + /** Error source, must be unspecified */ + source: "unspecified"; + /** Type of element of the user's Telegram Passport which has the issue */ + type: string; + /** Base64-encoded element hash */ + element_hash: string; + /** Error message */ + message: string; +} diff --git a/node_modules/@telegraf/types/payment.d.ts b/node_modules/@telegraf/types/payment.d.ts new file mode 100644 index 0000000..e0fcd73 --- /dev/null +++ b/node_modules/@telegraf/types/payment.d.ts @@ -0,0 +1,101 @@ +import type { User } from "./manage.js"; +/** This object represents a portion of the price for goods or services. */ +export interface LabeledPrice { + /** Portion label */ + label: string; + /** Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + amount: number; +} +/** This object contains basic information about an invoice. */ +export interface Invoice { + /** Product name */ + title: string; + /** Product description */ + description: string; + /** Unique bot deep-linking parameter that can be used to generate this invoice */ + start_parameter: string; + /** Three-letter ISO 4217 currency code */ + currency: string; + /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + total_amount: number; +} +/** This object represents a shipping address. */ +export interface ShippingAddress { + /** Two-letter ISO 3166-1 alpha-2 country code */ + country_code: string; + /** State, if applicable */ + state: string; + /** City */ + city: string; + /** First line for the address */ + street_line1: string; + /** Second line for the address */ + street_line2: string; + /** Address post code */ + post_code: string; +} +/** This object represents information about an order. */ +export interface OrderInfo { + /** User name */ + name?: string; + /** User's phone number */ + phone_number?: string; + /** User email */ + email?: string; + /** User shipping address */ + shipping_address?: ShippingAddress; +} +/** This object represents one shipping option. */ +export interface ShippingOption { + /** Shipping option identifier */ + id: string; + /** Option title */ + title: string; + /** List of price portions */ + prices: LabeledPrice[]; +} +/** This object contains basic information about a successful payment. */ +export interface SuccessfulPayment { + /** Three-letter ISO 4217 currency code */ + currency: string; + /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + total_amount: number; + /** Bot specified invoice payload */ + invoice_payload: string; + /** Identifier of the shipping option chosen by the user */ + shipping_option_id?: string; + /** Order information provided by the user */ + order_info?: OrderInfo; + /** Telegram payment identifier */ + telegram_payment_charge_id: string; + /** Provider payment identifier */ + provider_payment_charge_id: string; +} +/** This object contains information about an incoming shipping query. */ +export interface ShippingQuery { + /** Unique query identifier */ + id: string; + /** User who sent the query */ + from: User; + /** Bot specified invoice payload */ + invoice_payload: string; + /** User specified shipping address */ + shipping_address: ShippingAddress; +} +/** This object contains information about an incoming pre-checkout query. */ +export interface PreCheckoutQuery { + /** Unique query identifier */ + id: string; + /** User who sent the query */ + from: User; + /** Three-letter ISO 4217 currency code */ + currency: string; + /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + total_amount: number; + /** Bot specified invoice payload */ + invoice_payload: string; + /** Identifier of the shipping option chosen by the user */ + shipping_option_id?: string; + /** Order information provided by the user */ + order_info?: OrderInfo; +} diff --git a/node_modules/@telegraf/types/settings.d.ts b/node_modules/@telegraf/types/settings.d.ts new file mode 100644 index 0000000..dd86c7a --- /dev/null +++ b/node_modules/@telegraf/types/settings.d.ts @@ -0,0 +1,120 @@ +import type { WebAppInfo } from "./markup.js"; +/** This object represents the bot's name. */ +export interface BotName { + /** The bot's name */ + name: string; +} +/** This object represents the bot's description. */ +export interface BotDescription { + /** The bot's description */ + description: string; +} +/** This object represents the bot's short description. */ +export interface BotShortDescription { + /** The bot's short description */ + short_description: string; +} +/** This object describes the bot's menu button in a private chat. It should be one of +- MenuButtonCommands +- MenuButtonWebApp +- MenuButtonDefault + +If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands. */ +export type MenuButton = MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault; +/** Represents a menu button, which opens the bot's list of commands. */ +export interface MenuButtonCommands { + /** Type of the button, must be commands */ + type: "commands"; +} +/** Represents a menu button, which launches a Web App. */ +export interface MenuButtonWebApp { + /** Button type, must be web_app */ + type: "web_app"; + /** Text on the button */ + text: string; + /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. */ + web_app: WebAppInfo; +} +/** Describes that no specific value for the menu button was set. */ +export interface MenuButtonDefault { + /** Type of the button, must be default */ + type: "default"; +} +/** This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported: +- BotCommandScopeDefault +- BotCommandScopeAllPrivateChats +- BotCommandScopeAllGroupChats +- BotCommandScopeAllChatAdministrators +- BotCommandScopeChat +- BotCommandScopeChatAdministrators +- BotCommandScopeChatMember + +## Determining list of commands + +The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned: + +### Commands in the chat with the bot +- botCommandScopeChat + language_code +- botCommandScopeChat +- botCommandScopeAllPrivateChats + language_code +- botCommandScopeAllPrivateChats +- botCommandScopeDefault + language_code +- botCommandScopeDefault + +### Commands in group and supergroup chats +- botCommandScopeChatMember + language_code +- botCommandScopeChatMember +- botCommandScopeChatAdministrators + language_code (administrators only) +- botCommandScopeChatAdministrators (administrators only) +- botCommandScopeChat + language_code +- botCommandScopeChat +- botCommandScopeAllChatAdministrators + language_code (administrators only) +- botCommandScopeAllChatAdministrators (administrators only) +- botCommandScopeAllGroupChats + language_code +- botCommandScopeAllGroupChats +- botCommandScopeDefault + language_code +- botCommandScopeDefault */ +export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember; +/** Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. */ +export interface BotCommandScopeDefault { + /** Scope type, must be default */ + type: "default"; +} +/** Represents the scope of bot commands, covering all private chats. */ +export interface BotCommandScopeAllPrivateChats { + /** Scope type, must be all_private_chats */ + type: "all_private_chats"; +} +/** Represents the scope of bot commands, covering all group and supergroup chats. */ +export interface BotCommandScopeAllGroupChats { + /** Scope type, must be all_group_chats */ + type: "all_group_chats"; +} +/** Represents the scope of bot commands, covering all group and supergroup chat administrators. */ +export interface BotCommandScopeAllChatAdministrators { + /** Scope type, must be all_chat_administrators */ + type: "all_chat_administrators"; +} +/** Represents the scope of bot commands, covering a specific chat. */ +export interface BotCommandScopeChat { + /** Scope type, must be chat */ + type: "chat"; + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; +} +/** Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. */ +export interface BotCommandScopeChatAdministrators { + /** Scope type, must be chat_administrators */ + type: "chat_administrators"; + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; +} +/** Represents the scope of bot commands, covering a specific member of a group or supergroup chat. */ +export interface BotCommandScopeChatMember { + /** Scope type, must be chat_member */ + type: "chat_member"; + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + chat_id: number | string; + /** Unique identifier of the target user */ + user_id: number; +} diff --git a/node_modules/@telegraf/types/update.d.ts b/node_modules/@telegraf/types/update.d.ts new file mode 100644 index 0000000..bbd8a5d --- /dev/null +++ b/node_modules/@telegraf/types/update.d.ts @@ -0,0 +1,113 @@ +import type { ChosenInlineResult, InlineQuery } from "./inline.js"; +import type { Chat, ChatBoostRemoved, ChatBoostUpdated, ChatJoinRequest, ChatMemberUpdated, MessageReactionCountUpdated, MessageReactionUpdated, User } from "./manage.js"; +import type { CallbackQuery } from "./markup.js"; +import type { CommonMessageBundle, Message, Poll, PollAnswer } from "./message.js"; +import type { PreCheckoutQuery, ShippingQuery } from "./payment.js"; +export declare namespace Update { + /** Internal type holding properties that updates in channels share. */ + interface Channel { + chat: Chat.ChannelChat; + author_signature?: string; + from?: never; + } + /** Internal type holding properties that updates outside of channels share. */ + interface NonChannel { + chat: Exclude; + author_signature?: never; + from: User; + } + /** Internal type holding properties that updates about new messages share. */ + interface New { + edit_date?: never; + } + /** Internal type holding properties that updates about edited messages share. */ + interface Edited { + /** Date the message was last edited in Unix time */ + edit_date: number; + forward_from?: never; + forward_from_chat?: never; + forward_from_message_id?: never; + forward_signature?: never; + forward_sender_name?: never; + forward_date?: never; + } + interface AbstractUpdate { + /** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */ + update_id: number; + } + interface MessageUpdate extends AbstractUpdate { + /** New incoming message of any kind - text, photo, sticker, etc. */ + message: New & NonChannel & M; + } + interface EditedMessageUpdate extends AbstractUpdate { + /** New version of a message that is known to the bot and was edited */ + edited_message: Edited & NonChannel & M; + } + interface ChannelPostUpdate extends AbstractUpdate { + /** New incoming channel post of any kind - text, photo, sticker, etc. */ + channel_post: New & Channel & M; + } + interface EditedChannelPostUpdate extends AbstractUpdate { + /** New version of a channel post that is known to the bot and was edited */ + edited_channel_post: Edited & Channel & M; + } + interface MessageReactionUpdate extends AbstractUpdate { + /** A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify `"message_reaction"` in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots. */ + message_reaction: MessageReactionUpdated; + } + interface MessageReactionCountUpdate extends AbstractUpdate { + /** Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify `"message_reaction_count"` in the list of allowed_updates to receive these updates. */ + message_reaction_count: MessageReactionCountUpdated; + } + interface InlineQueryUpdate extends AbstractUpdate { + /** New incoming inline query */ + inline_query: InlineQuery; + } + interface ChosenInlineResultUpdate extends AbstractUpdate { + /** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */ + chosen_inline_result: ChosenInlineResult; + } + interface CallbackQueryUpdate extends AbstractUpdate { + /** New incoming callback query */ + callback_query: C; + } + interface ShippingQueryUpdate extends AbstractUpdate { + /** New incoming shipping query. Only for invoices with flexible price */ + shipping_query: ShippingQuery; + } + interface PreCheckoutQueryUpdate extends AbstractUpdate { + /** New incoming pre-checkout query. Contains full information about checkout */ + pre_checkout_query: PreCheckoutQuery; + } + interface PollUpdate extends AbstractUpdate { + /** New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */ + poll: Poll; + } + interface PollAnswerUpdate extends AbstractUpdate { + /** A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */ + poll_answer: PollAnswer; + } + interface MyChatMemberUpdate extends AbstractUpdate { + /** The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */ + my_chat_member: ChatMemberUpdated; + } + interface ChatMemberUpdate extends AbstractUpdate { + /** A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */ + chat_member: ChatMemberUpdated; + } + interface ChatJoinRequestUpdate extends AbstractUpdate { + /** A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. */ + chat_join_request: ChatJoinRequest; + } + interface ChatBoostUpdate extends AbstractUpdate { + /** A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates. */ + chat_boost: ChatBoostUpdated; + } + interface RemovedChatBoostUpdate extends AbstractUpdate { + /** A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. */ + removed_chat_boost: ChatBoostRemoved; + } +} +/** This object represents an incoming update. +At most one of the optional parameters can be present in any given update. */ +export type Update = Update.CallbackQueryUpdate | Update.ChannelPostUpdate | Update.ChatMemberUpdate | Update.ChosenInlineResultUpdate | Update.EditedChannelPostUpdate | Update.MessageReactionUpdate | Update.MessageReactionCountUpdate | Update.EditedMessageUpdate | Update.InlineQueryUpdate | Update.MessageUpdate | Update.MyChatMemberUpdate | Update.PreCheckoutQueryUpdate | Update.PollAnswerUpdate | Update.PollUpdate | Update.ShippingQueryUpdate | Update.ChatJoinRequestUpdate | Update.ChatBoostUpdate | Update.RemovedChatBoostUpdate; diff --git a/node_modules/abort-controller/LICENSE b/node_modules/abort-controller/LICENSE new file mode 100644 index 0000000..c914149 --- /dev/null +++ b/node_modules/abort-controller/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Toru Nagashima + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/abort-controller/README.md b/node_modules/abort-controller/README.md new file mode 100644 index 0000000..9de3e45 --- /dev/null +++ b/node_modules/abort-controller/README.md @@ -0,0 +1,98 @@ +# abort-controller + +[![npm version](https://img.shields.io/npm/v/abort-controller.svg)](https://www.npmjs.com/package/abort-controller) +[![Downloads/month](https://img.shields.io/npm/dm/abort-controller.svg)](http://www.npmtrends.com/abort-controller) +[![Build Status](https://travis-ci.org/mysticatea/abort-controller.svg?branch=master)](https://travis-ci.org/mysticatea/abort-controller) +[![Coverage Status](https://codecov.io/gh/mysticatea/abort-controller/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/abort-controller) +[![Dependency Status](https://david-dm.org/mysticatea/abort-controller.svg)](https://david-dm.org/mysticatea/abort-controller) + +An implementation of [WHATWG AbortController interface](https://dom.spec.whatwg.org/#interface-abortcontroller). + +```js +import AbortController from "abort-controller" + +const controller = new AbortController() +const signal = controller.signal + +signal.addEventListener("abort", () => { + console.log("aborted!") +}) + +controller.abort() +``` + +> https://jsfiddle.net/1r2994qp/1/ + +## 💿 Installation + +Use [npm](https://www.npmjs.com/) to install then use a bundler. + +``` +npm install abort-controller +``` + +Or download from [`dist` directory](./dist). + +- [dist/abort-controller.mjs](dist/abort-controller.mjs) ... ES modules version. +- [dist/abort-controller.js](dist/abort-controller.js) ... Common JS version. +- [dist/abort-controller.umd.js](dist/abort-controller.umd.js) ... UMD (Universal Module Definition) version. This is transpiled by [Babel](https://babeljs.io/) for IE 11. + +## 📖 Usage + +### Basic + +```js +import AbortController from "abort-controller" +// or +const AbortController = require("abort-controller") + +// or UMD version defines a global variable: +const AbortController = window.AbortControllerShim +``` + +If your bundler recognizes `browser` field of `package.json`, the imported `AbortController` is the native one and it doesn't contain shim (even if the native implementation was nothing). +If you wanted to polyfill `AbortController` for IE, use `abort-controller/polyfill`. + +### Polyfilling + +Importing `abort-controller/polyfill` assigns the `AbortController` shim to the `AbortController` global variable if the native implementation was nothing. + +```js +import "abort-controller/polyfill" +// or +require("abort-controller/polyfill") +``` + +### API + +#### AbortController + +> https://dom.spec.whatwg.org/#interface-abortcontroller + +##### controller.signal + +The [AbortSignal](https://dom.spec.whatwg.org/#interface-AbortSignal) object which is associated to this controller. + +##### controller.abort() + +Notify `abort` event to listeners that the `signal` has. + +## 📰 Changelog + +- See [GitHub releases](https://github.com/mysticatea/abort-controller/releases). + +## 🍻 Contributing + +Contributing is welcome ❤️ + +Please use GitHub issues/PRs. + +### Development tools + +- `npm install` installs dependencies for development. +- `npm test` runs tests and measures code coverage. +- `npm run clean` removes temporary files of tests. +- `npm run coverage` opens code coverage of the previous test with your default browser. +- `npm run lint` runs ESLint. +- `npm run build` generates `dist` codes. +- `npm run watch` runs tests on each file change. diff --git a/node_modules/abort-controller/browser.js b/node_modules/abort-controller/browser.js new file mode 100644 index 0000000..b0c5ec3 --- /dev/null +++ b/node_modules/abort-controller/browser.js @@ -0,0 +1,13 @@ +/*globals self, window */ +"use strict" + +/*eslint-disable @mysticatea/prettier */ +const { AbortController, AbortSignal } = + typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + /* otherwise */ undefined +/*eslint-enable @mysticatea/prettier */ + +module.exports = AbortController +module.exports.AbortSignal = AbortSignal +module.exports.default = AbortController diff --git a/node_modules/abort-controller/browser.mjs b/node_modules/abort-controller/browser.mjs new file mode 100644 index 0000000..a8f321a --- /dev/null +++ b/node_modules/abort-controller/browser.mjs @@ -0,0 +1,11 @@ +/*globals self, window */ + +/*eslint-disable @mysticatea/prettier */ +const { AbortController, AbortSignal } = + typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + /* otherwise */ undefined +/*eslint-enable @mysticatea/prettier */ + +export default AbortController +export { AbortController, AbortSignal } diff --git a/node_modules/abort-controller/dist/abort-controller.d.ts b/node_modules/abort-controller/dist/abort-controller.d.ts new file mode 100644 index 0000000..75852fb --- /dev/null +++ b/node_modules/abort-controller/dist/abort-controller.d.ts @@ -0,0 +1,43 @@ +import { EventTarget } from "event-target-shim" + +type Events = { + abort: any +} +type EventAttributes = { + onabort: any +} +/** + * The signal class. + * @see https://dom.spec.whatwg.org/#abortsignal + */ +declare class AbortSignal extends EventTarget { + /** + * AbortSignal cannot be constructed directly. + */ + constructor() + /** + * Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise. + */ + readonly aborted: boolean +} +/** + * The AbortController. + * @see https://dom.spec.whatwg.org/#abortcontroller + */ +declare class AbortController { + /** + * Initialize this controller. + */ + constructor() + /** + * Returns the `AbortSignal` object associated with this object. + */ + readonly signal: AbortSignal + /** + * Abort and signal to any observers that the associated activity is to be aborted. + */ + abort(): void +} + +export default AbortController +export { AbortController, AbortSignal } diff --git a/node_modules/abort-controller/dist/abort-controller.js b/node_modules/abort-controller/dist/abort-controller.js new file mode 100644 index 0000000..49af739 --- /dev/null +++ b/node_modules/abort-controller/dist/abort-controller.js @@ -0,0 +1,127 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var eventTargetShim = require('event-target-shim'); + +/** + * The signal class. + * @see https://dom.spec.whatwg.org/#abortsignal + */ +class AbortSignal extends eventTargetShim.EventTarget { + /** + * AbortSignal cannot be constructed directly. + */ + constructor() { + super(); + throw new TypeError("AbortSignal cannot be constructed directly"); + } + /** + * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise. + */ + get aborted() { + const aborted = abortedFlags.get(this); + if (typeof aborted !== "boolean") { + throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`); + } + return aborted; + } +} +eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort"); +/** + * Create an AbortSignal object. + */ +function createAbortSignal() { + const signal = Object.create(AbortSignal.prototype); + eventTargetShim.EventTarget.call(signal); + abortedFlags.set(signal, false); + return signal; +} +/** + * Abort a given signal. + */ +function abortSignal(signal) { + if (abortedFlags.get(signal) !== false) { + return; + } + abortedFlags.set(signal, true); + signal.dispatchEvent({ type: "abort" }); +} +/** + * Aborted flag for each instances. + */ +const abortedFlags = new WeakMap(); +// Properties should be enumerable. +Object.defineProperties(AbortSignal.prototype, { + aborted: { enumerable: true }, +}); +// `toString()` should return `"[object AbortSignal]"` +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortSignal", + }); +} + +/** + * The AbortController. + * @see https://dom.spec.whatwg.org/#abortcontroller + */ +class AbortController { + /** + * Initialize this controller. + */ + constructor() { + signals.set(this, createAbortSignal()); + } + /** + * Returns the `AbortSignal` object associated with this object. + */ + get signal() { + return getSignal(this); + } + /** + * Abort and signal to any observers that the associated activity is to be aborted. + */ + abort() { + abortSignal(getSignal(this)); + } +} +/** + * Associated signals. + */ +const signals = new WeakMap(); +/** + * Get the associated signal of a given controller. + */ +function getSignal(controller) { + const signal = signals.get(controller); + if (signal == null) { + throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`); + } + return signal; +} +// Properties should be enumerable. +Object.defineProperties(AbortController.prototype, { + signal: { enumerable: true }, + abort: { enumerable: true }, +}); +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortController", + }); +} + +exports.AbortController = AbortController; +exports.AbortSignal = AbortSignal; +exports.default = AbortController; + +module.exports = AbortController +module.exports.AbortController = module.exports["default"] = AbortController +module.exports.AbortSignal = AbortSignal +//# sourceMappingURL=abort-controller.js.map diff --git a/node_modules/abort-controller/dist/abort-controller.js.map b/node_modules/abort-controller/dist/abort-controller.js.map new file mode 100644 index 0000000..cfdcafd --- /dev/null +++ b/node_modules/abort-controller/dist/abort-controller.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abort-controller.js","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["EventTarget","defineEventAttribute"],"mappings":";;;;;;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQA,2BAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,SAAS,CACf,0DACI,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,IACpC,EAAE,CACL,CAAA;SACJ;QACD,OAAO,OAAO,CAAA;KACjB;CACJ;AACDC,oCAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;;;;AAKpD,SAAgB,iBAAiB;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACnDD,2BAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;CAChB;;;;AAKD,SAAgB,WAAW,CAAC,MAAmB;IAC3C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;QACpC,OAAM;KACT;IAED,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9B,MAAM,CAAC,aAAa,CAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;CACnD;;;;AAKD,MAAM,YAAY,GAAG,IAAI,OAAO,EAAwB,CAAA;;AAGxD,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE;IAC3C,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAChC,CAAC,CAAA;;AAGF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QAC7D,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,aAAa;KACvB,CAAC,CAAA;CACL;;ACpFD;;;;AAIA,MAAqB,eAAe;;;;IAIhC;QACI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;KACzC;;;;IAKD,IAAW,MAAM;QACb,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;KACzB;;;;IAKM,KAAK;QACR,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KAC/B;CACJ;;;;AAKD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAgC,CAAA;;;;AAK3D,SAAS,SAAS,CAAC,UAA2B;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,SAAS,CACf,8DACI,UAAU,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,UAC1C,EAAE,CACL,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;CAChB;;AAGD,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,SAAS,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5B,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA;AAEF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QACjE,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAA;CACL;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/abort-controller/dist/abort-controller.mjs b/node_modules/abort-controller/dist/abort-controller.mjs new file mode 100644 index 0000000..88ba22d --- /dev/null +++ b/node_modules/abort-controller/dist/abort-controller.mjs @@ -0,0 +1,118 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +import { EventTarget, defineEventAttribute } from 'event-target-shim'; + +/** + * The signal class. + * @see https://dom.spec.whatwg.org/#abortsignal + */ +class AbortSignal extends EventTarget { + /** + * AbortSignal cannot be constructed directly. + */ + constructor() { + super(); + throw new TypeError("AbortSignal cannot be constructed directly"); + } + /** + * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise. + */ + get aborted() { + const aborted = abortedFlags.get(this); + if (typeof aborted !== "boolean") { + throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`); + } + return aborted; + } +} +defineEventAttribute(AbortSignal.prototype, "abort"); +/** + * Create an AbortSignal object. + */ +function createAbortSignal() { + const signal = Object.create(AbortSignal.prototype); + EventTarget.call(signal); + abortedFlags.set(signal, false); + return signal; +} +/** + * Abort a given signal. + */ +function abortSignal(signal) { + if (abortedFlags.get(signal) !== false) { + return; + } + abortedFlags.set(signal, true); + signal.dispatchEvent({ type: "abort" }); +} +/** + * Aborted flag for each instances. + */ +const abortedFlags = new WeakMap(); +// Properties should be enumerable. +Object.defineProperties(AbortSignal.prototype, { + aborted: { enumerable: true }, +}); +// `toString()` should return `"[object AbortSignal]"` +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortSignal", + }); +} + +/** + * The AbortController. + * @see https://dom.spec.whatwg.org/#abortcontroller + */ +class AbortController { + /** + * Initialize this controller. + */ + constructor() { + signals.set(this, createAbortSignal()); + } + /** + * Returns the `AbortSignal` object associated with this object. + */ + get signal() { + return getSignal(this); + } + /** + * Abort and signal to any observers that the associated activity is to be aborted. + */ + abort() { + abortSignal(getSignal(this)); + } +} +/** + * Associated signals. + */ +const signals = new WeakMap(); +/** + * Get the associated signal of a given controller. + */ +function getSignal(controller) { + const signal = signals.get(controller); + if (signal == null) { + throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`); + } + return signal; +} +// Properties should be enumerable. +Object.defineProperties(AbortController.prototype, { + signal: { enumerable: true }, + abort: { enumerable: true }, +}); +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortController", + }); +} + +export default AbortController; +export { AbortController, AbortSignal }; +//# sourceMappingURL=abort-controller.mjs.map diff --git a/node_modules/abort-controller/dist/abort-controller.mjs.map b/node_modules/abort-controller/dist/abort-controller.mjs.map new file mode 100644 index 0000000..1e8fa6b --- /dev/null +++ b/node_modules/abort-controller/dist/abort-controller.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"abort-controller.mjs","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":[],"mappings":";;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQ,WAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,SAAS,CACf,0DACI,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,IACpC,EAAE,CACL,CAAA;SACJ;QACD,OAAO,OAAO,CAAA;KACjB;CACJ;AACD,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;;;;AAKpD,SAAgB,iBAAiB;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACnD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;CAChB;;;;AAKD,SAAgB,WAAW,CAAC,MAAmB;IAC3C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;QACpC,OAAM;KACT;IAED,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9B,MAAM,CAAC,aAAa,CAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;CACnD;;;;AAKD,MAAM,YAAY,GAAG,IAAI,OAAO,EAAwB,CAAA;;AAGxD,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE;IAC3C,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAChC,CAAC,CAAA;;AAGF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QAC7D,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,aAAa;KACvB,CAAC,CAAA;CACL;;ACpFD;;;;AAIA,MAAqB,eAAe;;;;IAIhC;QACI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;KACzC;;;;IAKD,IAAW,MAAM;QACb,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;KACzB;;;;IAKM,KAAK;QACR,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KAC/B;CACJ;;;;AAKD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAgC,CAAA;;;;AAK3D,SAAS,SAAS,CAAC,UAA2B;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,SAAS,CACf,8DACI,UAAU,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,UAC1C,EAAE,CACL,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;CAChB;;AAGD,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,SAAS,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5B,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA;AAEF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QACjE,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAA;CACL;;;;;"} \ No newline at end of file diff --git a/node_modules/abort-controller/dist/abort-controller.umd.js b/node_modules/abort-controller/dist/abort-controller.umd.js new file mode 100644 index 0000000..f643cfd --- /dev/null +++ b/node_modules/abort-controller/dist/abort-controller.umd.js @@ -0,0 +1,5 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.AbortControllerShim={}))})(this,function(a){'use strict';function b(a){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},b(a)}function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c,d=0;d\n * @copyright 2015 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\n/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap}\n * @private\n */\nconst privateData = new WeakMap();\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap}\n * @private\n */\nconst wrappers = new WeakMap();\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event);\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n );\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n );\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true;\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault();\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n });\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true });\n\n // Define accessors\n const keys = Object.keys(event);\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key));\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget;\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this);\n\n data.stopped = true;\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation();\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this);\n\n data.stopped = true;\n data.immediateStopped = true;\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation();\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this));\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this);\n\n data.stopped = true;\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true;\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this));\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n});\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype);\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event);\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value;\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event;\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto);\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event);\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n });\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n const isFunc = typeof descriptor.value === \"function\";\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n );\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto);\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);\n wrappers.set(proto, wrapper);\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nfunction wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event));\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nfunction isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nfunction setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase;\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nfunction setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget;\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nfunction setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener;\n}\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap>}\n * @private\n */\nconst listenersMap = new WeakMap();\n\n// Listener types\nconst CAPTURE = 1;\nconst BUBBLE = 2;\nconst ATTRIBUTE = 3;\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget);\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this);\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next;\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null; // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this);\n\n // Traverse to the tail while removing old value.\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n } else {\n prev = node;\n }\n\n node = node.next;\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n };\n if (prev === null) {\n listeners.set(eventName, newNode);\n } else {\n prev.next = newNode;\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n );\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this);\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n });\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map());\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length);\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i];\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this);\n const optionsIsObj = isObject(options);\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options);\n const listenerType = capture ? CAPTURE : BUBBLE;\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n };\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName);\n if (node === undefined) {\n listeners.set(eventName, newNode);\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null;\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node;\n node = node.next;\n }\n\n // Add it.\n prev.next = newNode;\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this);\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options);\n const listenerType = capture ? CAPTURE : BUBBLE;\n\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n return\n }\n\n prev = node;\n node = node.next;\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this);\n const eventName = event.type;\n let node = listeners.get(eventName);\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event);\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null;\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n } else {\n prev = node;\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n );\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent);\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err);\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent);\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next;\n }\n setPassiveListener(wrappedEvent, null);\n setEventPhase(wrappedEvent, 0);\n setCurrentTarget(wrappedEvent, null);\n\n return !wrappedEvent.defaultPrevented\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n});\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);\n}\n\nexport default EventTarget;\nexport { defineEventAttribute, EventTarget };\n//# sourceMappingURL=event-target-shim.mjs.map\n","import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["pd","event","retv","privateData","get","console","assert","setCancelFlag","data","passiveListener","cancelable","canceled","preventDefault","error","Event","eventTarget","set","eventPhase","currentTarget","stopped","immediateStopped","timeStamp","Date","now","Object","defineProperty","value","enumerable","key","keys","i","length","defineRedirectDescriptor","configurable","defineCallDescriptor","apply","arguments","defineWrapper","BaseEvent","proto","CustomEvent","call","prototype","create","constructor","writable","descriptor","getOwnPropertyDescriptor","isFunc","getWrapper","wrapper","wrappers","getPrototypeOf","wrapEvent","Wrapper","isStopped","setEventPhase","setCurrentTarget","setPassiveListener","createAbortSignal","signal","AbortSignal","EventTarget","abortedFlags","abortSignal","dispatchEvent","type","getSignal","controller","signals","TypeError","WeakMap","target","composedPath","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","stopPropagation","stopImmediatePropagation","bubbles","defaultPrevented","composed","srcElement","cancelBubble","returnValue","initEvent","window","setPrototypeOf","aborted","defineEventAttribute","defineProperties","Symbol","_typeof","toStringTag","AbortController","abort"],"mappings":";;;+3CAkCA,QAASA,CAAAA,CAAT,CAAYC,CAAZ,CAAmB,IACTC,CAAAA,CAAI,CAAGC,CAAW,CAACC,GAAZ,CAAgBH,CAAhB,QACbI,CAAAA,OAAO,CAACC,MAAR,CACY,IAAR,EAAAJ,CADJ,CAEI,6CAFJ,CAGID,CAHJ,EAKOC,EAOX,QAASK,CAAAA,CAAT,CAAuBC,CAAvB,CAA6B,OACG,KAAxB,EAAAA,CAAI,CAACC,eADgB,MAarB,CAACD,CAAI,CAACP,KAAL,CAAWS,UAbS,GAiBzBF,CAAI,CAACG,QAAL,GAjByB,CAkBgB,UAArC,QAAOH,CAAAA,CAAI,CAACP,KAAL,CAAWW,cAlBG,EAmBrBJ,CAAI,CAACP,KAAL,CAAWW,cAAX,EAnBqB,QAGE,WAAnB,QAAOP,CAAAA,OAAP,EACyB,UAAzB,QAAOA,CAAAA,OAAO,CAACQ,KAJE,EAMjBR,OAAO,CAACQ,KAAR,CACI,oEADJ,CAEIL,CAAI,CAACC,eAFT,CANiB,EAiC7B,QAASK,CAAAA,CAAT,CAAeC,CAAf,CAA4Bd,CAA5B,CAAmC,CAC/BE,CAAW,CAACa,GAAZ,CAAgB,IAAhB,CAAsB,CAClBD,WAAW,CAAXA,CADkB,CAElBd,KAAK,CAALA,CAFkB,CAGlBgB,UAAU,CAAE,CAHM,CAIlBC,aAAa,CAAEH,CAJG,CAKlBJ,QAAQ,GALU,CAMlBQ,OAAO,GANW,CAOlBC,gBAAgB,GAPE,CAQlBX,eAAe,CAAE,IARC,CASlBY,SAAS,CAAEpB,CAAK,CAACoB,SAAN,EAAmBC,IAAI,CAACC,GAAL,EATZ,CAAtB,CAD+B,CAc/BC,MAAM,CAACC,cAAP,CAAsB,IAAtB,CAA4B,WAA5B,CAAyC,CAAEC,KAAK,GAAP,CAAgBC,UAAU,GAA1B,CAAzC,CAd+B,QAmBrBC,CAAAA,EAFJC,CAAI,CAAGL,MAAM,CAACK,IAAP,CAAY5B,CAAZ,EACJ6B,CAAC,CAAG,EAAGA,CAAC,CAAGD,CAAI,CAACE,OAAQ,EAAED,EACzBF,EAAMC,CAAI,CAACC,CAAD,EACVF,CAAG,GAAI,OACTJ,MAAM,CAACC,cAAP,CAAsB,IAAtB,CAA4BG,CAA5B,CAAiCI,CAAwB,CAACJ,CAAD,CAAzD,EAyOZ,QAASI,CAAAA,CAAT,CAAkCJ,CAAlC,CAAuC,OAC5B,CACHxB,GADG,WACG,OACKJ,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASC,KAAT,CAAe2B,CAAf,CAFR,CAAA,CAIHZ,GAJG,UAICU,EAAO,CACP1B,CAAE,CAAC,IAAD,CAAF,CAASC,KAAT,CAAe2B,CAAf,EAAsBF,CALvB,CAAA,CAOHO,YAAY,GAPT,CAQHN,UAAU,GARP,EAkBX,QAASO,CAAAA,CAAT,CAA8BN,CAA9B,CAAmC,OACxB,CACHF,KADG,WACK,IACEzB,CAAAA,CAAK,CAAGD,CAAE,CAAC,IAAD,CAAF,CAASC,YAChBA,CAAAA,CAAK,CAAC2B,CAAD,CAAL,CAAWO,KAAX,CAAiBlC,CAAjB,CAAwBmC,SAAxB,CAHR,CAAA,CAKHH,YAAY,GALT,CAMHN,UAAU,GANP,EAiBX,QAASU,CAAAA,CAAT,CAAuBC,CAAvB,CAAkCC,CAAlC,CAAyC,SAO5BC,CAAAA,EAAYzB,EAAad,EAAO,CACrCqC,CAAS,CAACG,IAAV,CAAe,IAAf,CAAqB1B,CAArB,CAAkCd,CAAlC,KAPE4B,CAAAA,CAAI,CAAGL,MAAM,CAACK,IAAP,CAAYU,CAAZ,KACO,CAAhB,GAAAV,CAAI,CAACE,aACEO,CAAAA,EAQXE,CAAW,CAACE,SAAZ,CAAwBlB,MAAM,CAACmB,MAAP,CAAcL,CAAS,CAACI,SAAxB,CAAmC,CACvDE,WAAW,CAAE,CAAElB,KAAK,CAAEc,CAAT,CAAsBP,YAAY,GAAlC,CAA0CY,QAAQ,GAAlD,CAD0C,CAAnC,CAXa,KAgBhC,GACKjB,CAAAA,CADL,CAAIE,CAAC,CAAG,EAAGA,CAAC,CAAGD,CAAI,CAACE,OAAQ,EAAED,KACzBF,EAAMC,CAAI,CAACC,CAAD,EACZ,EAAEF,CAAG,GAAIU,CAAAA,CAAS,CAACI,SAAnB,EAA+B,IACzBI,CAAAA,CAAU,CAAGtB,MAAM,CAACuB,wBAAP,CAAgCR,CAAhC,CAAuCX,CAAvC,CADY,CAEzBoB,CAAM,CAA+B,UAA5B,QAAOF,CAAAA,CAAU,CAACpB,KAFF,CAG/BF,MAAM,CAACC,cAAP,CACIe,CAAW,CAACE,SADhB,CAEId,CAFJ,CAGIoB,CAAM,CACAd,CAAoB,CAACN,CAAD,CADpB,CAEAI,CAAwB,CAACJ,CAAD,CALlC,QAUDY,CAAAA,EASX,QAASS,CAAAA,CAAT,CAAoBV,CAApB,CAA2B,IACV,IAAT,EAAAA,CAAK,EAAYA,CAAK,GAAKf,MAAM,CAACkB,gBAC3B5B,CAAAA,KAGPoC,CAAAA,CAAO,CAAGC,CAAQ,CAAC/C,GAAT,CAAamC,CAAb,QACC,KAAX,EAAAW,IACAA,CAAO,CAAGb,CAAa,CAACY,CAAU,CAACzB,MAAM,CAAC4B,cAAP,CAAsBb,CAAtB,CAAD,CAAX,CAA2CA,CAA3C,EACvBY,CAAQ,CAACnC,GAAT,CAAauB,CAAb,CAAoBW,CAApB,GAEGA,EAUJ,QAASG,CAAAA,CAAT,CAAmBtC,CAAnB,CAAgCd,CAAhC,CAAuC,IACpCqD,CAAAA,CAAO,CAAGL,CAAU,CAACzB,MAAM,CAAC4B,cAAP,CAAsBnD,CAAtB,CAAD,QACnB,IAAIqD,CAAAA,CAAJ,CAAYvC,CAAZ,CAAyBd,CAAzB,EASJ,QAASsD,CAAAA,CAAT,CAAmBtD,CAAnB,CAA0B,OACtBD,CAAAA,CAAE,CAACC,CAAD,CAAF,CAAUmB,iBAUd,QAASoC,CAAAA,CAAT,CAAuBvD,CAAvB,CAA8BgB,CAA9B,CAA0C,CAC7CjB,CAAE,CAACC,CAAD,CAAF,CAAUgB,UAAV,CAAuBA,EAUpB,QAASwC,CAAAA,CAAT,CAA0BxD,CAA1B,CAAiCiB,CAAjC,CAAgD,CACnDlB,CAAE,CAACC,CAAD,CAAF,CAAUiB,aAAV,CAA0BA,EAUvB,QAASwC,CAAAA,CAAT,CAA4BzD,CAA5B,CAAmCQ,CAAnC,CAAoD,CACvDT,CAAE,CAACC,CAAD,CAAF,CAAUQ,eAAV,CAA4BA,ysCC1ahBkD,CAAAA,OACNC,CAAAA,CAAM,CAAGpC,MAAM,CAACmB,MAAPnB,CAAcqC,CAAW,CAACnB,SAA1BlB,QACfsC,CAAAA,CAAW,CAACrB,IAAZqB,CAAiBF,CAAjBE,EACAC,CAAY,CAAC/C,GAAb+C,CAAiBH,CAAjBG,KACOH,UAMKI,CAAAA,EAAYJ,GACpBG,KAAAA,CAAY,CAAC3D,GAAb2D,CAAiBH,CAAjBG,IAIJA,CAAY,CAAC/C,GAAb+C,CAAiBH,CAAjBG,KACAH,CAAM,CAACK,aAAPL,CAA8B,CAAEM,IAAI,CAAE,OAAR,CAA9BN,GC9BJ,QAASO,CAAAA,CAAT,CAAmBC,CAAnB,KACUR,CAAAA,CAAM,CAAGS,CAAO,CAACjE,GAARiE,CAAYD,CAAZC,KACD,IAAVT,EAAAA,OACM,IAAIU,CAAAA,SAAJ,sEAEiB,IAAfF,GAAAA,CAAU,CAAY,MAAZ,GAA4BA,GAFxC,QAMHR,CAAAA,KF3BLzD,CAAAA,CAAW,CAAG,GAAIoE,CAAAA,QAOlBpB,CAAQ,CAAG,GAAIoB,CAAAA,QAkFrBzD,CAAK,CAAC4B,SAAN,CAAkB,IAKVwB,CAAAA,MAAO,OACAlE,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASC,KAAT,CAAeiE,IANZ,CAAA,IAaVM,CAAAA,QAAS,OACFxE,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASe,WAdN,CAAA,IAqBVG,CAAAA,eAAgB,OACTlB,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASkB,aAtBN,CAAA,CA4BduD,YA5Bc,WA4BC,IACLvD,CAAAA,CAAa,CAAGlB,CAAE,CAAC,IAAD,CAAF,CAASkB,cADpB,MAEU,KAAjB,EAAAA,CAFO,CAGA,EAHA,CAKJ,CAACA,CAAD,CAjCG,CAAA,IAwCVwD,CAAAA,MAAO,OACA,EAzCG,CAAA,IAgDVC,CAAAA,iBAAkB,OACX,EAjDG,CAAA,IAwDVC,CAAAA,WAAY,OACL,EAzDG,CAAA,IAgEVC,CAAAA,gBAAiB,OACV,EAjEG,CAAA,IAwEV5D,CAAAA,YAAa,OACNjB,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASiB,UAzEN,CAAA,CAgFd6D,eAhFc,WAgFI,IACRtE,CAAAA,CAAI,CAAGR,CAAE,CAAC,IAAD,EAEfQ,CAAI,CAACW,OAAL,GAHc,CAI4B,UAAtC,QAAOX,CAAAA,CAAI,CAACP,KAAL,CAAW6E,eAJR,EAKVtE,CAAI,CAACP,KAAL,CAAW6E,eAAX,EArFM,CAAA,CA6FdC,wBA7Fc,WA6Fa,IACjBvE,CAAAA,CAAI,CAAGR,CAAE,CAAC,IAAD,EAEfQ,CAAI,CAACW,OAAL,GAHuB,CAIvBX,CAAI,CAACY,gBAAL,GAJuB,CAK4B,UAA/C,QAAOZ,CAAAA,CAAI,CAACP,KAAL,CAAW8E,wBALC,EAMnBvE,CAAI,CAACP,KAAL,CAAW8E,wBAAX,EAnGM,CAAA,IA2GVC,CAAAA,SAAU,SACKhF,CAAE,CAAC,IAAD,CAAF,CAASC,KAAT,CAAe+E,OA5GpB,CAAA,IAmHVtE,CAAAA,YAAa,SACEV,CAAE,CAAC,IAAD,CAAF,CAASC,KAAT,CAAeS,UApHpB,CAAA,CA2HdE,cA3Hc,WA2HG,CACbL,CAAa,CAACP,CAAE,CAAC,IAAD,CAAH,CA5HH,CAAA,IAmIViF,CAAAA,kBAAmB,OACZjF,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASW,QApIN,CAAA,IA2IVuE,CAAAA,UAAW,SACIlF,CAAE,CAAC,IAAD,CAAF,CAASC,KAAT,CAAeiF,QA5IpB,CAAA,IAmJV7D,CAAAA,WAAY,OACLrB,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASqB,SApJN,CAAA,IA4JV8D,CAAAA,YAAa,OACNnF,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASe,WA7JN,CAAA,IAqKVqE,CAAAA,cAAe,OACRpF,CAAAA,CAAE,CAAC,IAAD,CAAF,CAASmB,OAtKN,CAAA,IAwKViE,CAAAA,aAAa1D,EAAO,IACfA,MAGClB,CAAAA,CAAI,CAAGR,CAAE,CAAC,IAAD,EAEfQ,CAAI,CAACW,OAAL,IACuC,SAAnC,QAAOX,CAAAA,CAAI,CAACP,KAAL,CAAWmF,eAClB5E,CAAI,CAACP,KAAL,CAAWmF,YAAX,KAhLM,CAAA,IAyLVC,CAAAA,aAAc,OACP,CAACrF,CAAE,CAAC,IAAD,CAAF,CAASW,QA1LP,CAAA,IA4LV0E,CAAAA,YAAY3D,EAAO,CACdA,CADc,EAEfnB,CAAa,CAACP,CAAE,CAAC,IAAD,CAAH,CA9LP,CAAA,CAyMdsF,SAzMc,WAyMF,EAzME,EA+MlB9D,MAAM,CAACC,cAAP,CAAsBX,CAAK,CAAC4B,SAA5B,CAAuC,aAAvC,CAAsD,CAClDhB,KAAK,CAAEZ,CAD2C,CAElDmB,YAAY,GAFsC,CAGlDY,QAAQ,GAH0C,CAAtD,EAOsB,WAAlB,QAAO0C,CAAAA,MAAP,EAAyD,WAAxB,QAAOA,CAAAA,MAAM,CAACzE,QAC/CU,MAAM,CAACgE,cAAP,CAAsB1E,CAAK,CAAC4B,SAA5B,CAAuC6C,MAAM,CAACzE,KAAP,CAAa4B,SAApD,EAGAS,CAAQ,CAACnC,GAAT,CAAauE,MAAM,CAACzE,KAAP,CAAa4B,SAA1B,CAAqC5B,CAArC,wiDChTiB+C,CAAAA,2EAMP,GAAIS,CAAAA,SAAJ,CAAc,4CAAd,sDAOAmB,CAAAA,CAAO,CAAG1B,CAAY,CAAC3D,GAAb2D,CAAiB,IAAjBA,KACO,SAAnB,QAAO0B,CAAAA,OACD,IAAInB,CAAAA,SAAJ,kEAEW,IAAT,QAAgB,MAAhB,GAAgC,MAFlC,QAMHmB,CAAAA,SArB0B3B,GAwBzC4B,CAAoB,CAAC7B,CAAW,CAACnB,SAAb,CAAwB,OAAxB,EA2BpB,GAAMqB,CAAAA,CAAY,CAAG,GAAIQ,CAAAA,OAAzB,CAGA/C,MAAM,CAACmE,gBAAPnE,CAAwBqC,CAAW,CAACnB,SAApClB,CAA+C,CAC3CiE,OAAO,CAAE,CAAE9D,UAAU,GAAZ,CADkC,CAA/CH,EAKsB,UAAlB,QAAOoE,CAAAA,MAAP,EAA8D,QAA9B,GAAAC,EAAOD,MAAM,CAACE,cAC9CtE,MAAM,CAACC,cAAPD,CAAsBqC,CAAW,CAACnB,SAAlClB,CAA6CoE,MAAM,CAACE,WAApDtE,CAAiE,CAC7DS,YAAY,GADiD,CAE7DP,KAAK,CAAE,aAFsD,CAAjEF,KC5EiBuE,CAAAA,oCAKb1B,CAAO,CAACrD,GAARqD,CAAY,IAAZA,CAAkBV,CAAiB,EAAnCU,4CAcAL,CAAW,CAACG,CAAS,CAAC,IAAD,CAAV,uCAPJA,CAAAA,CAAS,CAAC,IAAD,WAclBE,CAAO,CAAG,GAAIE,CAAAA,WAkBpB/C,MAAM,CAACmE,gBAAPnE,CAAwBuE,CAAe,CAACrD,SAAxClB,CAAmD,CAC/CoC,MAAM,CAAE,CAAEjC,UAAU,GAAZ,CADuC,CAE/CqE,KAAK,CAAE,CAAErE,UAAU,GAAZ,CAFwC,CAAnDH,EAKsB,UAAlB,QAAOoE,CAAAA,MAAP,EAA8D,QAA9B,GAAAC,EAAOD,MAAM,CAACE,cAC9CtE,MAAM,CAACC,cAAPD,CAAsBuE,CAAe,CAACrD,SAAtClB,CAAiDoE,MAAM,CAACE,WAAxDtE,CAAqE,CACjES,YAAY,GADqD,CAEjEP,KAAK,CAAE,iBAF0D,CAArEF"} \ No newline at end of file diff --git a/node_modules/abort-controller/package.json b/node_modules/abort-controller/package.json new file mode 100644 index 0000000..fc705e0 --- /dev/null +++ b/node_modules/abort-controller/package.json @@ -0,0 +1,97 @@ +{ + "name": "abort-controller", + "version": "3.0.0", + "description": "An implementation of WHATWG AbortController interface.", + "main": "dist/abort-controller", + "files": [ + "dist", + "polyfill.*", + "browser.*" + ], + "engines": { + "node": ">=6.5" + }, + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "browser": "./browser.js", + "devDependencies": { + "@babel/core": "^7.2.2", + "@babel/plugin-transform-modules-commonjs": "^7.2.0", + "@babel/preset-env": "^7.3.0", + "@babel/register": "^7.0.0", + "@mysticatea/eslint-plugin": "^8.0.1", + "@mysticatea/spy": "^0.1.2", + "@types/mocha": "^5.2.5", + "@types/node": "^10.12.18", + "assert": "^1.4.1", + "codecov": "^3.1.0", + "dts-bundle-generator": "^2.0.0", + "eslint": "^5.12.1", + "karma": "^3.1.4", + "karma-chrome-launcher": "^2.2.0", + "karma-coverage": "^1.1.2", + "karma-firefox-launcher": "^1.1.0", + "karma-growl-reporter": "^1.0.0", + "karma-ie-launcher": "^1.0.0", + "karma-mocha": "^1.3.0", + "karma-rollup-preprocessor": "^7.0.0-rc.2", + "mocha": "^5.2.0", + "npm-run-all": "^4.1.5", + "nyc": "^13.1.0", + "opener": "^1.5.1", + "rimraf": "^2.6.3", + "rollup": "^1.1.2", + "rollup-plugin-babel": "^4.3.2", + "rollup-plugin-babel-minify": "^7.0.0", + "rollup-plugin-commonjs": "^9.2.0", + "rollup-plugin-node-resolve": "^4.0.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-typescript": "^1.0.0", + "rollup-watch": "^4.3.1", + "ts-node": "^8.0.1", + "type-tester": "^1.0.0", + "typescript": "^3.2.4" + }, + "scripts": { + "preversion": "npm test", + "version": "npm run -s build && git add dist/*", + "postversion": "git push && git push --tags", + "clean": "rimraf .nyc_output coverage", + "coverage": "opener coverage/lcov-report/index.html", + "lint": "eslint . --ext .ts", + "build": "run-s -s build:*", + "build:rollup": "rollup -c", + "build:dts": "dts-bundle-generator -o dist/abort-controller.d.ts src/abort-controller.ts && ts-node scripts/fix-dts", + "test": "run-s -s lint test:*", + "test:mocha": "nyc mocha test/*.ts", + "test:karma": "karma start --single-run", + "watch": "run-p -s watch:*", + "watch:mocha": "mocha test/*.ts --require ts-node/register --watch-extensions ts --watch --growl", + "watch:karma": "karma start --watch", + "codecov": "codecov" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mysticatea/abort-controller.git" + }, + "keywords": [ + "w3c", + "whatwg", + "event", + "events", + "abort", + "cancel", + "abortcontroller", + "abortsignal", + "controller", + "signal", + "shim" + ], + "author": "Toru Nagashima (https://github.com/mysticatea)", + "license": "MIT", + "bugs": { + "url": "https://github.com/mysticatea/abort-controller/issues" + }, + "homepage": "https://github.com/mysticatea/abort-controller#readme" +} diff --git a/node_modules/abort-controller/polyfill.js b/node_modules/abort-controller/polyfill.js new file mode 100644 index 0000000..3ca8923 --- /dev/null +++ b/node_modules/abort-controller/polyfill.js @@ -0,0 +1,21 @@ +/*globals require, self, window */ +"use strict" + +const ac = require("./dist/abort-controller") + +/*eslint-disable @mysticatea/prettier */ +const g = + typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + typeof global !== "undefined" ? global : + /* otherwise */ undefined +/*eslint-enable @mysticatea/prettier */ + +if (g) { + if (typeof g.AbortController === "undefined") { + g.AbortController = ac.AbortController + } + if (typeof g.AbortSignal === "undefined") { + g.AbortSignal = ac.AbortSignal + } +} diff --git a/node_modules/abort-controller/polyfill.mjs b/node_modules/abort-controller/polyfill.mjs new file mode 100644 index 0000000..0602a64 --- /dev/null +++ b/node_modules/abort-controller/polyfill.mjs @@ -0,0 +1,19 @@ +/*globals self, window */ +import * as ac from "./dist/abort-controller" + +/*eslint-disable @mysticatea/prettier */ +const g = + typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + typeof global !== "undefined" ? global : + /* otherwise */ undefined +/*eslint-enable @mysticatea/prettier */ + +if (g) { + if (typeof g.AbortController === "undefined") { + g.AbortController = ac.AbortController + } + if (typeof g.AbortSignal === "undefined") { + g.AbortSignal = ac.AbortSignal + } +} diff --git a/node_modules/buffer-alloc-unsafe/index.js b/node_modules/buffer-alloc-unsafe/index.js new file mode 100644 index 0000000..0bd335f --- /dev/null +++ b/node_modules/buffer-alloc-unsafe/index.js @@ -0,0 +1,17 @@ +function allocUnsafe (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number') + } + + if (size < 0) { + throw new RangeError('"size" argument must not be negative') + } + + if (Buffer.allocUnsafe) { + return Buffer.allocUnsafe(size) + } else { + return new Buffer(size) + } +} + +module.exports = allocUnsafe diff --git a/node_modules/buffer-alloc-unsafe/package.json b/node_modules/buffer-alloc-unsafe/package.json new file mode 100644 index 0000000..c2ab904 --- /dev/null +++ b/node_modules/buffer-alloc-unsafe/package.json @@ -0,0 +1,24 @@ +{ + "name": "buffer-alloc-unsafe", + "version": "1.1.0", + "license": "MIT", + "repository": "LinusU/buffer-alloc-unsafe", + "files": [ + "index.js" + ], + "scripts": { + "test": "standard && node test" + }, + "devDependencies": { + "standard": "^7.1.2" + }, + "keywords": [ + "allocUnsafe", + "allocate", + "buffer allocUnsafe", + "buffer unsafe allocate", + "buffer", + "ponyfill", + "unsafe allocate" + ] +} diff --git a/node_modules/buffer-alloc-unsafe/readme.md b/node_modules/buffer-alloc-unsafe/readme.md new file mode 100644 index 0000000..8725ecf --- /dev/null +++ b/node_modules/buffer-alloc-unsafe/readme.md @@ -0,0 +1,46 @@ +# Buffer Alloc Unsafe + +A [ponyfill](https://ponyfill.com) for `Buffer.allocUnsafe`. + +Works as Node.js: `v7.0.0`
+Works on Node.js: `v0.10.0` + +## Installation + +```sh +npm install --save buffer-alloc-unsafe +``` + +## Usage + +```js +const allocUnsafe = require('buffer-alloc-unsafe') + +console.log(allocUnsafe(10)) +//=> + +console.log(allocUnsafe(10)) +//=> + +console.log(allocUnsafe(10)) +//=> + +allocUnsafe(-10) +//=> RangeError: "size" argument must not be negative +``` + +## API + +### allocUnsafe(size) + +- `size` <Integer> The desired length of the new `Buffer` + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be +less than or equal to the value of `buffer.kMaxLength` and greater than or equal +to zero. Otherwise, a `RangeError` is thrown. + +## See also + +- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc` +- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill` +- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from` diff --git a/node_modules/buffer-alloc/index.js b/node_modules/buffer-alloc/index.js new file mode 100644 index 0000000..fe65860 --- /dev/null +++ b/node_modules/buffer-alloc/index.js @@ -0,0 +1,32 @@ +var bufferFill = require('buffer-fill') +var allocUnsafe = require('buffer-alloc-unsafe') + +module.exports = function alloc (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number') + } + + if (size < 0) { + throw new RangeError('"size" argument must not be negative') + } + + if (Buffer.alloc) { + return Buffer.alloc(size, fill, encoding) + } + + var buffer = allocUnsafe(size) + + if (size === 0) { + return buffer + } + + if (fill === undefined) { + return bufferFill(buffer, 0) + } + + if (typeof encoding !== 'string') { + encoding = undefined + } + + return bufferFill(buffer, fill, encoding) +} diff --git a/node_modules/buffer-alloc/package.json b/node_modules/buffer-alloc/package.json new file mode 100644 index 0000000..a8a3c3a --- /dev/null +++ b/node_modules/buffer-alloc/package.json @@ -0,0 +1,26 @@ +{ + "name": "buffer-alloc", + "version": "1.2.0", + "license": "MIT", + "repository": "LinusU/buffer-alloc", + "files": [ + "index.js" + ], + "scripts": { + "test": "standard && node test" + }, + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + }, + "devDependencies": { + "standard": "^7.1.2" + }, + "keywords": [ + "alloc", + "allocate", + "buffer alloc", + "buffer allocate", + "buffer" + ] +} diff --git a/node_modules/buffer-alloc/readme.md b/node_modules/buffer-alloc/readme.md new file mode 100644 index 0000000..80c7d7b --- /dev/null +++ b/node_modules/buffer-alloc/readme.md @@ -0,0 +1,43 @@ +# Buffer Alloc + +A [ponyfill](https://ponyfill.com) for `Buffer.alloc`. + +Works as Node.js: `v7.0.0`
+Works on Node.js: `v0.10.0` + +## Installation + +```sh +npm install --save buffer-alloc +``` + +## Usage + +```js +const alloc = require('buffer-alloc') + +console.log(alloc(4)) +//=> + +console.log(alloc(6, 0x41)) +//=> + +console.log(alloc(10, 'linus', 'utf8')) +//=> +``` + +## API + +### alloc(size[, fill[, encoding]]) + +- `size` <Integer> The desired length of the new `Buffer` +- `fill` <String> | <Buffer> | <Integer> A value to pre-fill the new `Buffer` with. **Default:** `0` +- `encoding` <String> If `fill` is a string, this is its encoding. **Default:** `'utf8'` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled. + +## See also + +- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe` +- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill` +- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from` diff --git a/node_modules/buffer-fill/index.js b/node_modules/buffer-fill/index.js new file mode 100644 index 0000000..428a9e1 --- /dev/null +++ b/node_modules/buffer-fill/index.js @@ -0,0 +1,113 @@ +/* Node.js 6.4.0 and up has full support */ +var hasFullSupport = (function () { + try { + if (!Buffer.isEncoding('latin1')) { + return false + } + + var buf = Buffer.alloc ? Buffer.alloc(4) : new Buffer(4) + + buf.fill('ab', 'ucs2') + + return (buf.toString('hex') === '61006200') + } catch (_) { + return false + } +}()) + +function isSingleByte (val) { + return (val.length === 1 && val.charCodeAt(0) < 256) +} + +function fillWithNumber (buffer, val, start, end) { + if (start < 0 || end > buffer.length) { + throw new RangeError('Out of range index') + } + + start = start >>> 0 + end = end === undefined ? buffer.length : end >>> 0 + + if (end > start) { + buffer.fill(val, start, end) + } + + return buffer +} + +function fillWithBuffer (buffer, val, start, end) { + if (start < 0 || end > buffer.length) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return buffer + } + + start = start >>> 0 + end = end === undefined ? buffer.length : end >>> 0 + + var pos = start + var len = val.length + while (pos <= (end - len)) { + val.copy(buffer, pos) + pos += len + } + + if (pos !== end) { + val.copy(buffer, pos, 0, end - pos) + } + + return buffer +} + +function fill (buffer, val, start, end, encoding) { + if (hasFullSupport) { + return buffer.fill(val, start, end, encoding) + } + + if (typeof val === 'number') { + return fillWithNumber(buffer, val, start, end) + } + + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = buffer.length + } else if (typeof end === 'string') { + encoding = end + end = buffer.length + } + + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + + if (encoding === 'latin1') { + encoding = 'binary' + } + + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + if (val === '') { + return fillWithNumber(buffer, 0, start, end) + } + + if (isSingleByte(val)) { + return fillWithNumber(buffer, val.charCodeAt(0), start, end) + } + + val = new Buffer(val, encoding) + } + + if (Buffer.isBuffer(val)) { + return fillWithBuffer(buffer, val, start, end) + } + + // Other values (e.g. undefined, boolean, object) results in zero-fill + return fillWithNumber(buffer, 0, start, end) +} + +module.exports = fill diff --git a/node_modules/buffer-fill/package.json b/node_modules/buffer-fill/package.json new file mode 100644 index 0000000..b8f67c5 --- /dev/null +++ b/node_modules/buffer-fill/package.json @@ -0,0 +1,16 @@ +{ + "name": "buffer-fill", + "version": "1.0.0", + "license": "MIT", + "repository": "LinusU/buffer-fill", + "files": [ + "index.js" + ], + "scripts": { + "test": "standard && node test" + }, + "devDependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "standard": "^7.1.2" + } +} diff --git a/node_modules/buffer-fill/readme.md b/node_modules/buffer-fill/readme.md new file mode 100644 index 0000000..ac30738 --- /dev/null +++ b/node_modules/buffer-fill/readme.md @@ -0,0 +1,54 @@ +# Buffer Fill + +A [ponyfill](https://ponyfill.com) for `Buffer.fill`. + +Works as Node.js: `v6.4.0`
+Works on Node.js: `v0.10.0` + +## Installation + +```sh +npm install --save buffer-fill +``` + +## Usage + +```js +const fill = require('buffer-fill') +const buf = Buffer.allocUnsafe(5) + +console.log(buf.fill(8)) +//=> + +console.log(buf.fill(9, 2, 4)) +//=> + +console.log(buf.fill('linus', 'latin1')) +//=> + +console.log(buf.fill('\u0222')) +//=> +``` + +## API + +### fill(buf, value[, offset[, end]][, encoding]) + +- `value` <String> | <Buffer> | <Integer> The value to fill `buf` with +- `offset` <Integer> Where to start filling `buf`. **Default:** `0` +- `end` <Integer> Where to stop filling `buf` (not inclusive). **Default:** `buf.length` +- `encoding` <String> If `value` is a string, this is its encoding. **Default:** `'utf8'` +- Return: <Buffer> A reference to `buf` + +Fills `buf` with the specified `value`. If the `offset` and `end` are not given, +the entire `buf` will be filled. This is meant to be a small simplification to +allow the creation and filling of a `Buffer` to be done on a single line. + +If the final write of a `fill()` operation falls on a multi-byte character, then +only the first bytes of that character that fit into `buf` are written. + +## See also + +- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe` +- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc` +- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from` diff --git a/node_modules/debug/LICENSE b/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/debug/README.md b/node_modules/debug/README.md new file mode 100644 index 0000000..9ebdfbf --- /dev/null +++ b/node_modules/debug/README.md @@ -0,0 +1,481 @@ +# debug +[![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. + + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json new file mode 100644 index 0000000..ee8abb5 --- /dev/null +++ b/node_modules/debug/package.json @@ -0,0 +1,64 @@ +{ + "name": "debug", + "version": "4.4.3", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon (https://github.com/qix-)", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "mocha test.js test.node.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "^2.1.3" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "sinon": "^14.0.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + }, + "xo": { + "rules": { + "import/extensions": "off" + } + } +} diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js new file mode 100644 index 0000000..5993451 --- /dev/null +++ b/node_modules/debug/src/browser.js @@ -0,0 +1,272 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + let m; + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // eslint-disable-next-line no-return-assign + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/debug/src/common.js b/node_modules/debug/src/common.js new file mode 100644 index 0000000..141cb57 --- /dev/null +++ b/node_modules/debug/src/common.js @@ -0,0 +1,292 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + const split = (typeof namespaces === 'string' ? namespaces : '') + .trim() + .replace(/\s+/g, ',') + .split(',') + .filter(Boolean); + + for (const ns of split) { + if (ns[0] === '-') { + createDebug.skips.push(ns.slice(1)); + } else { + createDebug.names.push(ns); + } + } + } + + /** + * Checks if the given string matches a namespace template, honoring + * asterisks as wildcards. + * + * @param {String} search + * @param {String} template + * @return {Boolean} + */ + function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + + while (searchIndex < search.length) { + if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { + // Match character or proceed with wildcard + if (template[templateIndex] === '*') { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; // Skip the '*' + } else { + searchIndex++; + templateIndex++; + } + } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition + // Backtrack to the last '*' and try to match more characters + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; + } else { + return false; // No match + } + } + + // Handle trailing '*' in template + while (templateIndex < template.length && template[templateIndex] === '*') { + templateIndex++; + } + + return templateIndex === template.length; + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names, + ...createDebug.skips.map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + for (const skip of createDebug.skips) { + if (matchesTemplate(name, skip)) { + return false; + } + } + + for (const ns of createDebug.names) { + if (matchesTemplate(name, ns)) { + return true; + } + } + + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/debug/src/index.js b/node_modules/debug/src/index.js new file mode 100644 index 0000000..bf4c57f --- /dev/null +++ b/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/debug/src/node.js b/node_modules/debug/src/node.js new file mode 100644 index 0000000..715560a --- /dev/null +++ b/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/dotenv/CHANGELOG.md b/node_modules/dotenv/CHANGELOG.md new file mode 100644 index 0000000..8b80dd6 --- /dev/null +++ b/node_modules/dotenv/CHANGELOG.md @@ -0,0 +1,520 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [Unreleased](https://github.com/motdotla/dotenv/compare/v16.6.1...master) + +## [16.6.1](https://github.com/motdotla/dotenv/compare/v16.6.0...v16.6.1) (2025-06-27) + +### Changed + +- Default `quiet` to true – hiding the runtime log message ([#874](https://github.com/motdotla/dotenv/pull/874)) +- NOTICE: 17.0.0 will be released with quiet defaulting to false. Use `config({ quiet: true })` to suppress. +- And check out the new [dotenvx](https://github.com/dotenvx/dotenvx). As coding workflows evolve and agents increasingly handle secrets, encrypted .env files offer a much safer way to deploy both agents and code together with secure secrets. Simply switch `require('dotenv').config()` for `require('@dotenvx/dotenvx').config()`. + +## [16.6.0](https://github.com/motdotla/dotenv/compare/v16.5.0...v16.6.0) (2025-06-26) + +### Added + +- Default log helpful message `[dotenv@16.6.0] injecting env (1) from .env` ([#870](https://github.com/motdotla/dotenv/pull/870)) +- Use `{ quiet: true }` to suppress +- Aligns dotenv more closely with [dotenvx](https://github.com/dotenvx/dotenvx). + +## [16.5.0](https://github.com/motdotla/dotenv/compare/v16.4.7...v16.5.0) (2025-04-07) + +### Added + +- 🎉 Added new sponsor [Graphite](https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=dotenv) - *the AI developer productivity platform helping teams on GitHub ship higher quality software, faster*. + +> [!TIP] +> **[Become a sponsor](https://github.com/sponsors/motdotla)** +> +> The dotenvx README is viewed thousands of times DAILY on GitHub and NPM. +> Sponsoring dotenv is a great way to get in front of developers and give back to the developer community at the same time. + +### Changed + +- Remove `_log` method. Use `_debug` [#862](https://github.com/motdotla/dotenv/pull/862) + +## [16.4.7](https://github.com/motdotla/dotenv/compare/v16.4.6...v16.4.7) (2024-12-03) + +### Changed + +- Ignore `.tap` folder when publishing. (oops, sorry about that everyone. - @motdotla) [#848](https://github.com/motdotla/dotenv/pull/848) + +## [16.4.6](https://github.com/motdotla/dotenv/compare/v16.4.5...v16.4.6) (2024-12-02) + +### Changed + +- Clean up stale dev dependencies [#847](https://github.com/motdotla/dotenv/pull/847) +- Various README updates clarifying usage and alternative solutions using [dotenvx](https://github.com/dotenvx/dotenvx) + +## [16.4.5](https://github.com/motdotla/dotenv/compare/v16.4.4...v16.4.5) (2024-02-19) + +### Changed + +- 🐞 Fix recent regression when using `path` option. return to historical behavior: do not attempt to auto find `.env` if `path` set. (regression was introduced in `16.4.3`) [#814](https://github.com/motdotla/dotenv/pull/814) + +## [16.4.4](https://github.com/motdotla/dotenv/compare/v16.4.3...v16.4.4) (2024-02-13) + +### Changed + +- 🐞 Replaced chaining operator `?.` with old school `&&` (fixing node 12 failures) [#812](https://github.com/motdotla/dotenv/pull/812) + +## [16.4.3](https://github.com/motdotla/dotenv/compare/v16.4.2...v16.4.3) (2024-02-12) + +### Changed + +- Fixed processing of multiple files in `options.path` [#805](https://github.com/motdotla/dotenv/pull/805) + +## [16.4.2](https://github.com/motdotla/dotenv/compare/v16.4.1...v16.4.2) (2024-02-10) + +### Changed + +- Changed funding link in package.json to [`dotenvx.com`](https://dotenvx.com) + +## [16.4.1](https://github.com/motdotla/dotenv/compare/v16.4.0...v16.4.1) (2024-01-24) + +- Patch support for array as `path` option [#797](https://github.com/motdotla/dotenv/pull/797) + +## [16.4.0](https://github.com/motdotla/dotenv/compare/v16.3.2...v16.4.0) (2024-01-23) + +- Add `error.code` to error messages around `.env.vault` decryption handling [#795](https://github.com/motdotla/dotenv/pull/795) +- Add ability to find `.env.vault` file when filename(s) passed as an array [#784](https://github.com/motdotla/dotenv/pull/784) + +## [16.3.2](https://github.com/motdotla/dotenv/compare/v16.3.1...v16.3.2) (2024-01-18) + +### Added + +- Add debug message when no encoding set [#735](https://github.com/motdotla/dotenv/pull/735) + +### Changed + +- Fix output typing for `populate` [#792](https://github.com/motdotla/dotenv/pull/792) +- Use subarray instead of slice [#793](https://github.com/motdotla/dotenv/pull/793) + +## [16.3.1](https://github.com/motdotla/dotenv/compare/v16.3.0...v16.3.1) (2023-06-17) + +### Added + +- Add missing type definitions for `processEnv` and `DOTENV_KEY` options. [#756](https://github.com/motdotla/dotenv/pull/756) + +## [16.3.0](https://github.com/motdotla/dotenv/compare/v16.2.0...v16.3.0) (2023-06-16) + +### Added + +- Optionally pass `DOTENV_KEY` to options rather than relying on `process.env.DOTENV_KEY`. Defaults to `process.env.DOTENV_KEY` [#754](https://github.com/motdotla/dotenv/pull/754) + +## [16.2.0](https://github.com/motdotla/dotenv/compare/v16.1.4...v16.2.0) (2023-06-15) + +### Added + +- Optionally write to your own target object rather than `process.env`. Defaults to `process.env`. [#753](https://github.com/motdotla/dotenv/pull/753) +- Add import type URL to types file [#751](https://github.com/motdotla/dotenv/pull/751) + +## [16.1.4](https://github.com/motdotla/dotenv/compare/v16.1.3...v16.1.4) (2023-06-04) + +### Added + +- Added `.github/` to `.npmignore` [#747](https://github.com/motdotla/dotenv/pull/747) + +## [16.1.3](https://github.com/motdotla/dotenv/compare/v16.1.2...v16.1.3) (2023-05-31) + +### Removed + +- Removed `browser` keys for `path`, `os`, and `crypto` in package.json. These were set to false incorrectly as of 16.1. Instead, if using dotenv on the front-end make sure to include polyfills for `path`, `os`, and `crypto`. [node-polyfill-webpack-plugin](https://github.com/Richienb/node-polyfill-webpack-plugin) provides these. + +## [16.1.2](https://github.com/motdotla/dotenv/compare/v16.1.1...v16.1.2) (2023-05-31) + +### Changed + +- Exposed private function `_configDotenv` as `configDotenv`. [#744](https://github.com/motdotla/dotenv/pull/744) + +## [16.1.1](https://github.com/motdotla/dotenv/compare/v16.1.0...v16.1.1) (2023-05-30) + +### Added + +- Added type definition for `decrypt` function + +### Changed + +- Fixed `{crypto: false}` in `packageJson.browser` + +## [16.1.0](https://github.com/motdotla/dotenv/compare/v16.0.3...v16.1.0) (2023-05-30) + +### Added + +- Add `populate` convenience method [#733](https://github.com/motdotla/dotenv/pull/733) +- Accept URL as path option [#720](https://github.com/motdotla/dotenv/pull/720) +- Add dotenv to `npm fund` command +- Spanish language README [#698](https://github.com/motdotla/dotenv/pull/698) +- Add `.env.vault` support. 🎉 ([#730](https://github.com/motdotla/dotenv/pull/730)) + +ℹ️ `.env.vault` extends the `.env` file format standard with a localized encrypted vault file. Package it securely with your production code deploys. It's cloud agnostic so that you can deploy your secrets anywhere – without [risky third-party integrations](https://techcrunch.com/2023/01/05/circleci-breach/). [read more](https://github.com/motdotla/dotenv#-deploying) + +### Changed + +- Fixed "cannot resolve 'fs'" error on tools like Replit [#693](https://github.com/motdotla/dotenv/pull/693) + +## [16.0.3](https://github.com/motdotla/dotenv/compare/v16.0.2...v16.0.3) (2022-09-29) + +### Changed + +- Added library version to debug logs ([#682](https://github.com/motdotla/dotenv/pull/682)) + +## [16.0.2](https://github.com/motdotla/dotenv/compare/v16.0.1...v16.0.2) (2022-08-30) + +### Added + +- Export `env-options.js` and `cli-options.js` in package.json for use with downstream [dotenv-expand](https://github.com/motdotla/dotenv-expand) module + +## [16.0.1](https://github.com/motdotla/dotenv/compare/v16.0.0...v16.0.1) (2022-05-10) + +### Changed + +- Minor README clarifications +- Development ONLY: updated devDependencies as recommended for development only security risks ([#658](https://github.com/motdotla/dotenv/pull/658)) + +## [16.0.0](https://github.com/motdotla/dotenv/compare/v15.0.1...v16.0.0) (2022-02-02) + +### Added + +- _Breaking:_ Backtick support 🎉 ([#615](https://github.com/motdotla/dotenv/pull/615)) + +If you had values containing the backtick character, please quote those values with either single or double quotes. + +## [15.0.1](https://github.com/motdotla/dotenv/compare/v15.0.0...v15.0.1) (2022-02-02) + +### Changed + +- Properly parse empty single or double quoted values 🐞 ([#614](https://github.com/motdotla/dotenv/pull/614)) + +## [15.0.0](https://github.com/motdotla/dotenv/compare/v14.3.2...v15.0.0) (2022-01-31) + +`v15.0.0` is a major new release with some important breaking changes. + +### Added + +- _Breaking:_ Multiline parsing support (just works. no need for the flag.) + +### Changed + +- _Breaking:_ `#` marks the beginning of a comment (UNLESS the value is wrapped in quotes. Please update your `.env` files to wrap in quotes any values containing `#`. For example: `SECRET_HASH="something-with-a-#-hash"`). + +..Understandably, (as some teams have noted) this is tedious to do across the entire team. To make it less tedious, we recommend using [dotenv cli](https://github.com/dotenv-org/cli) going forward. It's an optional plugin that will keep your `.env` files in sync between machines, environments, or team members. + +### Removed + +- _Breaking:_ Remove multiline option (just works out of the box now. no need for the flag.) + +## [14.3.2](https://github.com/motdotla/dotenv/compare/v14.3.1...v14.3.2) (2022-01-25) + +### Changed + +- Preserve backwards compatibility on values containing `#` 🐞 ([#603](https://github.com/motdotla/dotenv/pull/603)) + +## [14.3.1](https://github.com/motdotla/dotenv/compare/v14.3.0...v14.3.1) (2022-01-25) + +### Changed + +- Preserve backwards compatibility on exports by re-introducing the prior in-place exports 🐞 ([#606](https://github.com/motdotla/dotenv/pull/606)) + +## [14.3.0](https://github.com/motdotla/dotenv/compare/v14.2.0...v14.3.0) (2022-01-24) + +### Added + +- Add `multiline` option 🎉 ([#486](https://github.com/motdotla/dotenv/pull/486)) + +## [14.2.0](https://github.com/motdotla/dotenv/compare/v14.1.1...v14.2.0) (2022-01-17) + +### Added + +- Add `dotenv_config_override` cli option +- Add `DOTENV_CONFIG_OVERRIDE` command line env option + +## [14.1.1](https://github.com/motdotla/dotenv/compare/v14.1.0...v14.1.1) (2022-01-17) + +### Added + +- Add React gotcha to FAQ on README + +## [14.1.0](https://github.com/motdotla/dotenv/compare/v14.0.1...v14.1.0) (2022-01-17) + +### Added + +- Add `override` option 🎉 ([#595](https://github.com/motdotla/dotenv/pull/595)) + +## [14.0.1](https://github.com/motdotla/dotenv/compare/v14.0.0...v14.0.1) (2022-01-16) + +### Added + +- Log error on failure to load `.env` file ([#594](https://github.com/motdotla/dotenv/pull/594)) + +## [14.0.0](https://github.com/motdotla/dotenv/compare/v13.0.1...v14.0.0) (2022-01-16) + +### Added + +- _Breaking:_ Support inline comments for the parser 🎉 ([#568](https://github.com/motdotla/dotenv/pull/568)) + +## [13.0.1](https://github.com/motdotla/dotenv/compare/v13.0.0...v13.0.1) (2022-01-16) + +### Changed + +* Hide comments and newlines from debug output ([#404](https://github.com/motdotla/dotenv/pull/404)) + +## [13.0.0](https://github.com/motdotla/dotenv/compare/v12.0.4...v13.0.0) (2022-01-16) + +### Added + +* _Breaking:_ Add type file for `config.js` ([#539](https://github.com/motdotla/dotenv/pull/539)) + +## [12.0.4](https://github.com/motdotla/dotenv/compare/v12.0.3...v12.0.4) (2022-01-16) + +### Changed + +* README updates +* Minor order adjustment to package json format + +## [12.0.3](https://github.com/motdotla/dotenv/compare/v12.0.2...v12.0.3) (2022-01-15) + +### Changed + +* Simplified jsdoc for consistency across editors + +## [12.0.2](https://github.com/motdotla/dotenv/compare/v12.0.1...v12.0.2) (2022-01-15) + +### Changed + +* Improve embedded jsdoc type documentation + +## [12.0.1](https://github.com/motdotla/dotenv/compare/v12.0.0...v12.0.1) (2022-01-15) + +### Changed + +* README updates and clarifications + +## [12.0.0](https://github.com/motdotla/dotenv/compare/v11.0.0...v12.0.0) (2022-01-15) + +### Removed + +- _Breaking:_ drop support for Flow static type checker ([#584](https://github.com/motdotla/dotenv/pull/584)) + +### Changed + +- Move types/index.d.ts to lib/main.d.ts ([#585](https://github.com/motdotla/dotenv/pull/585)) +- Typescript cleanup ([#587](https://github.com/motdotla/dotenv/pull/587)) +- Explicit typescript inclusion in package.json ([#566](https://github.com/motdotla/dotenv/pull/566)) + +## [11.0.0](https://github.com/motdotla/dotenv/compare/v10.0.0...v11.0.0) (2022-01-11) + +### Changed + +- _Breaking:_ drop support for Node v10 ([#558](https://github.com/motdotla/dotenv/pull/558)) +- Patch debug option ([#550](https://github.com/motdotla/dotenv/pull/550)) + +## [10.0.0](https://github.com/motdotla/dotenv/compare/v9.0.2...v10.0.0) (2021-05-20) + +### Added + +- Add generic support to parse function +- Allow for import "dotenv/config.js" +- Add support to resolve home directory in path via ~ + +## [9.0.2](https://github.com/motdotla/dotenv/compare/v9.0.1...v9.0.2) (2021-05-10) + +### Changed + +- Support windows newlines with debug mode + +## [9.0.1](https://github.com/motdotla/dotenv/compare/v9.0.0...v9.0.1) (2021-05-08) + +### Changed + +- Updates to README + +## [9.0.0](https://github.com/motdotla/dotenv/compare/v8.6.0...v9.0.0) (2021-05-05) + +### Changed + +- _Breaking:_ drop support for Node v8 + +## [8.6.0](https://github.com/motdotla/dotenv/compare/v8.5.1...v8.6.0) (2021-05-05) + +### Added + +- define package.json in exports + +## [8.5.1](https://github.com/motdotla/dotenv/compare/v8.5.0...v8.5.1) (2021-05-05) + +### Changed + +- updated dev dependencies via npm audit + +## [8.5.0](https://github.com/motdotla/dotenv/compare/v8.4.0...v8.5.0) (2021-05-05) + +### Added + +- allow for `import "dotenv/config"` + +## [8.4.0](https://github.com/motdotla/dotenv/compare/v8.3.0...v8.4.0) (2021-05-05) + +### Changed + +- point to exact types file to work with VS Code + +## [8.3.0](https://github.com/motdotla/dotenv/compare/v8.2.0...v8.3.0) (2021-05-05) + +### Changed + +- _Breaking:_ drop support for Node v8 (mistake to be released as minor bump. later bumped to 9.0.0. see above.) + +## [8.2.0](https://github.com/motdotla/dotenv/compare/v8.1.0...v8.2.0) (2019-10-16) + +### Added + +- TypeScript types + +## [8.1.0](https://github.com/motdotla/dotenv/compare/v8.0.0...v8.1.0) (2019-08-18) + +### Changed + +- _Breaking:_ drop support for Node v6 ([#392](https://github.com/motdotla/dotenv/issues/392)) + +# [8.0.0](https://github.com/motdotla/dotenv/compare/v7.0.0...v8.0.0) (2019-05-02) + +### Changed + +- _Breaking:_ drop support for Node v6 ([#302](https://github.com/motdotla/dotenv/issues/392)) + +## [7.0.0] - 2019-03-12 + +### Fixed + +- Fix removing unbalanced quotes ([#376](https://github.com/motdotla/dotenv/pull/376)) + +### Removed + +- Removed `load` alias for `config` for consistency throughout code and documentation. + +## [6.2.0] - 2018-12-03 + +### Added + +- Support preload configuration via environment variables ([#351](https://github.com/motdotla/dotenv/issues/351)) + +## [6.1.0] - 2018-10-08 + +### Added + +- `debug` option for `config` and `parse` methods will turn on logging + +## [6.0.0] - 2018-06-02 + +### Changed + +- _Breaking:_ drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304)) + +## [5.0.0] - 2018-01-29 + +### Added + +- Testing against Node v8 and v9 +- Documentation on trim behavior of values +- Documentation on how to use with `import` + +### Changed + +- _Breaking_: default `path` is now `path.resolve(process.cwd(), '.env')` +- _Breaking_: does not write over keys already in `process.env` if the key has a falsy value +- using `const` and `let` instead of `var` + +### Removed + +- Testing against Node v7 + +## [4.0.0] - 2016-12-23 + +### Changed + +- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)). + +### Removed + +- `verbose` option removed in favor of returning result. + +## [3.0.0] - 2016-12-20 + +### Added + +- `verbose` option will log any error messages. Off by default. +- parses email addresses correctly +- allow importing config method directly in ES6 + +### Changed + +- Suppress error messages by default ([#154](https://github.com/motdotla/dotenv/pull/154)) +- Ignoring more files for NPM to make package download smaller + +### Fixed + +- False positive test due to case-sensitive variable ([#124](https://github.com/motdotla/dotenv/pull/124)) + +### Removed + +- `silent` option removed in favor of `verbose` + +## [2.0.0] - 2016-01-20 + +### Added + +- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README +- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README +- Testing nodejs v4 on travis-ci +- added examples of how to use dotenv in different ways +- return parsed object on success rather than boolean true + +### Changed + +- README has shorter description not referencing ruby gem since we don't have or want feature parity + +### Removed + +- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal + +## [1.2.0] - 2015-06-20 + +### Added + +- Preload hook to require dotenv without including it in your code + +### Changed + +- clarified license to be "BSD-2-Clause" in `package.json` + +### Fixed + +- retain spaces in string vars + +## [1.1.0] - 2015-03-31 + +### Added + +- Silent option to silence `console.log` when `.env` missing + +## [1.0.0] - 2015-03-13 + +### Removed + +- support for multiple `.env` files. should always use one `.env` file for the current environment + +[7.0.0]: https://github.com/motdotla/dotenv/compare/v6.2.0...v7.0.0 +[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0 +[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0 +[6.0.0]: https://github.com/motdotla/dotenv/compare/v5.0.0...v6.0.0 +[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0 +[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0 +[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0 +[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0 +[1.2.0]: https://github.com/motdotla/dotenv/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/motdotla/dotenv/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/motdotla/dotenv/compare/v0.4.0...v1.0.0 diff --git a/node_modules/dotenv/LICENSE b/node_modules/dotenv/LICENSE new file mode 100644 index 0000000..c430ad8 --- /dev/null +++ b/node_modules/dotenv/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Scott Motte +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/dotenv/README-es.md b/node_modules/dotenv/README-es.md new file mode 100644 index 0000000..5fc934d --- /dev/null +++ b/node_modules/dotenv/README-es.md @@ -0,0 +1,411 @@ +
+🎉 announcing dotenvx. run anywhere, multi-environment, encrypted envs. +
+ +  + + + +# dotenv [![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) + +dotenv + +Dotenv es un módulo de dependencia cero que carga las variables de entorno desde un archivo `.env` en [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). El almacenamiento de la configuración del entorno separado del código está basado en la metodología [The Twelve-Factor App](http://12factor.net/config). + +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![LICENSE](https://img.shields.io/github/license/motdotla/dotenv.svg)](LICENSE) + +## Instalación + +```bash +# instalación local (recomendado) +npm install dotenv --save +``` + +O installación con yarn? `yarn add dotenv` + +## Uso + +Cree un archivo `.env` en la raíz de su proyecto: + +```dosini +S3_BUCKET="YOURS3BUCKET" +SECRET_KEY="YOURSECRETKEYGOESHERE" +``` + +Tan prónto como sea posible en su aplicación, importe y configure dotenv: + +```javascript +require('dotenv').config() +console.log(process.env) // elimine esto después que haya confirmado que esta funcionando +``` + +.. o usa ES6? + +```javascript +import * as dotenv from 'dotenv' // vea en https://github.com/motdotla/dotenv#como-uso-dotenv-con-import +// REVISAR LINK DE REFERENCIA DE IMPORTACIÓN +dotenv.config() +import express from 'express' +``` + +Eso es todo. `process.env` ahora tiene las claves y los valores que definiste en tu archivo `.env`: + +```javascript +require('dotenv').config() + +... + +s3.getBucketCors({Bucket: process.env.S3_BUCKET}, function(err, data) {}) +``` + +### Valores multilínea + +Si necesita variables de varias líneas, por ejemplo, claves privadas, ahora se admiten en la versión (`>= v15.0.0`) con saltos de línea: + +```dosini +PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY----- +... +Kh9NV... +... +-----END RSA PRIVATE KEY-----" +``` + +Alternativamente, puede usar comillas dobles y usar el carácter `\n`: + +```dosini +PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nKh9NV...\n-----END RSA PRIVATE KEY-----\n" +``` + +### Comentarios + +Los comentarios pueden ser agregados en tu archivo o en la misma línea: + +```dosini +# This is a comment +SECRET_KEY=YOURSECRETKEYGOESHERE # comment +SECRET_HASH="something-with-a-#-hash" +``` + +Los comentarios comienzan donde existe un `#`, entonces, si su valor contiene un `#`, enciérrelo entre comillas. Este es un cambio importante desde la versión `>= v15.0.0` en adelante. + +### Análisis + +El motor que analiza el contenido de su archivo que contiene variables de entorno está disponible para su uso. Este Acepta una Cadena o un Búfer y devolverá un Objeto con las claves y los valores analizados. + +```javascript +const dotenv = require('dotenv') +const buf = Buffer.from('BASICO=basico') +const config = dotenv.parse(buf) // devolverá un objeto +console.log(typeof config, config) // objeto { BASICO : 'basico' } +``` + +### Precarga + +Puede usar el `--require` (`-r`) [opción de línea de comando](https://nodejs.org/api/cli.html#-r---require-module) para precargar dotenv. Al hacer esto, no necesita requerir ni cargar dotnev en el código de su aplicación. + +```bash +$ node -r dotenv/config tu_script.js +``` + +Las opciones de configuración a continuación se admiten como argumentos de línea de comandos en el formato `dotenv_config_