diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index 4335784e5..0313fdc19 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -554,6 +554,13 @@ "functionName": "newSuperalgosBotModulesTelegramBot", "fileName": "TelegramBot.js", "folderName": "Trading-Bot/Announcements" + }, + { + "name": "Trading Process", + "propertyName": "tradingProcess", + "functionName": "newSuperalgosBotModulesTradingProcess", + "fileName": "TradingProcess.js", + "folderName": "Trading-Bot/Low-Frequency-Trading" } ] }, diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf new file mode 100644 index 000000000..8dbd5c902 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../telegraf/bin/telegraf" "$@" + ret=$? +else + node "$basedir/../telegraf/bin/telegraf" "$@" + ret=$? +fi +exit $ret diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf.cmd b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf.cmd new file mode 100644 index 000000000..251a1f3fc --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf.cmd @@ -0,0 +1,17 @@ +@ECHO off +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +"%_prog%" "%dp0%\..\telegraf\bin\telegraf" %* +ENDLOCAL +EXIT /b %errorlevel% +:find_dp0 +SET dp0=%~dp0 +EXIT /b diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf.ps1 b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf.ps1 new file mode 100644 index 000000000..d36067824 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/.bin/telegraf.ps1 @@ -0,0 +1,18 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + & "$basedir/node$exe" "$basedir/../telegraf/bin/telegraf" $args + $ret=$LASTEXITCODE +} else { + & "node$exe" "$basedir/../telegraf/bin/telegraf" $args + $ret=$LASTEXITCODE +} +exit $ret diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/LICENSE b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/LICENSE new file mode 100644 index 000000000..658c933d2 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +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/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/README.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/README.md new file mode 100644 index 000000000..88dae35d9 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/README.md @@ -0,0 +1,455 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![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); +``` + + +## 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. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## 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> + +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/TaskServer/node_modules/debug/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/package.json similarity index 59% rename from TaskServer/node_modules/debug/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/package.json index 0bb80da2a..1736b6fbb 100644 --- a/TaskServer/node_modules/debug/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/package.json @@ -1,8 +1,8 @@ { "_from": "debug@^4.0.1", - "_id": "debug@4.1.1", + "_id": "debug@4.3.1", "_inBundle": false, - "_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "_integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "_location": "/debug", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/telegraf" ], - "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "_shasum": "3b72260255109c6b589cee050f1d516139664791", + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "_shasum": "f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee", "_spec": "debug@^4.0.1", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer\\node_modules\\telegraf", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements\\node_modules\\telegraf", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" @@ -40,34 +40,35 @@ { "name": "Andrew Rhyne", "email": "rhyneandrew@gmail.com" + }, + { + "name": "Josh Junon", + "email": "josh@junon.me" } ], "dependencies": { - "ms": "^2.1.1" + "ms": "2.1.2" }, "deprecated": false, "description": "small debugging utility", "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "browserify": "14.4.0", - "chai": "^3.5.0", - "concurrently": "^3.1.0", + "brfs": "^2.0.1", + "browserify": "^16.2.3", "coveralls": "^3.0.2", "istanbul": "^0.4.5", - "karma": "^3.0.0", - "karma-chai": "^0.1.0", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", "karma-mocha": "^1.3.0", - "karma-phantomjs-launcher": "^1.0.2", "mocha": "^5.2.0", "mocha-lcov-reporter": "^1.2.0", - "rimraf": "^2.5.4", "xo": "^0.23.0" }, + "engines": { + "node": ">=6.0" + }, "files": [ "src", - "dist/debug.js", "LICENSE", "README.md" ], @@ -80,23 +81,21 @@ "license": "MIT", "main": "./src/index.js", "name": "debug", + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, "repository": { "type": "git", "url": "git://github.com/visionmedia/debug.git" }, "scripts": { - "build": "npm run build:debug && npm run build:test", - "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", - "build:test": "babel -d dist test.js", - "clean": "rimraf dist coverage", "lint": "xo", - "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", - "pretest:browser": "npm run build", - "test": "npm run test:node && npm run test:browser", + "test": "npm run test:node && npm run test:browser && npm run lint", "test:browser": "karma start --single-run", "test:coverage": "cat ./coverage/lcov.info | coveralls", "test:node": "istanbul cover _mocha -- test.js" }, - "unpkg": "./dist/debug.js", - "version": "4.1.1" + "version": "4.3.1" } diff --git a/TaskServer/node_modules/debug/src/browser.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/browser.js similarity index 91% rename from TaskServer/node_modules/debug/src/browser.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/browser.js index 5f34c0d0a..cd0fc35d1 100644 --- a/TaskServer/node_modules/debug/src/browser.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/browser.js @@ -4,12 +4,21 @@ * This is the web browser implementation of `debug()`. */ -exports.log = log; 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. @@ -170,18 +179,14 @@ function formatArgs(args) { } /** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". + * 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 */ -function log(...args) { - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return typeof console === 'object' && - console.log && - console.log(...args); -} +exports.log = console.debug || console.log || (() => {}); /** * Save `namespaces`. diff --git a/TaskServer/node_modules/debug/src/common.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/common.js similarity index 87% rename from TaskServer/node_modules/debug/src/common.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/common.js index 2f82b8dc7..392a8e005 100644 --- a/TaskServer/node_modules/debug/src/common.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/common.js @@ -12,16 +12,12 @@ function setup(env) { createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = require('ms'); + createDebug.destroy = destroy; Object.keys(env).forEach(key => { createDebug[key] = env[key]; }); - /** - * Active `debug` instances. - */ - createDebug.instances = []; - /** * The currently active debug mode names, and names to skip. */ @@ -63,6 +59,7 @@ function setup(env) { */ function createDebug(namespace) { let prevTime; + let enableOverride = null; function debug(...args) { // Disabled? @@ -92,7 +89,7 @@ function setup(env) { 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 match; + return '%'; } index++; const formatter = createDebug.formatters[format]; @@ -115,33 +112,28 @@ function setup(env) { } debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; + debug.color = createDebug.selectColor(namespace); debug.extend = extend; - // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. - // env-specific initialization logic for debug instances + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } - createDebug.instances.push(debug); - return debug; } - function destroy() { - const index = createDebug.instances.indexOf(this); - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - return false; - } - function extend(namespace, delimiter) { const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); newDebug.log = this.log; @@ -179,11 +171,6 @@ function setup(env) { createDebug.names.push(new RegExp('^' + namespaces + '$')); } } - - for (i = 0; i < createDebug.instances.length; i++) { - const instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } } /** @@ -258,6 +245,14 @@ function setup(env) { 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; diff --git a/TaskServer/node_modules/debug/src/index.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/index.js similarity index 100% rename from TaskServer/node_modules/debug/src/index.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/index.js diff --git a/TaskServer/node_modules/debug/src/node.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/node.js similarity index 94% rename from TaskServer/node_modules/debug/src/node.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/node.js index 5e1f1541a..79bc085cb 100644 --- a/TaskServer/node_modules/debug/src/node.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/debug/src/node.js @@ -15,6 +15,10 @@ 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. @@ -244,7 +248,9 @@ const {formatters} = module.exports; formatters.o = function (v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); + .split('\n') + .map(str => str.trim()) + .join(' '); }; /** diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/.travis.yml b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/.travis.yml new file mode 100644 index 000000000..74c57bf15 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.12" + - "iojs" +before_install: + - npm install -g npm@~1.4.6 diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/LICENSE b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/LICENSE new file mode 100644 index 000000000..ee27ba4b4 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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/TaskServer/node_modules/minimist/example/parse.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/example/parse.js similarity index 100% rename from TaskServer/node_modules/minimist/example/parse.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/example/parse.js diff --git a/TaskServer/node_modules/minimist/index.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/index.js similarity index 100% rename from TaskServer/node_modules/minimist/index.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/index.js diff --git a/TaskServer/node_modules/minimist/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/package.json similarity index 93% rename from TaskServer/node_modules/minimist/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/package.json index fd7871c8f..fd5ba7d71 100644 --- a/TaskServer/node_modules/minimist/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "_shasum": "67d66014b66a6a8aaa0c083c5fd58df4e4e97602", "_spec": "minimist@^1.2.0", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer\\node_modules\\telegraf", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements\\node_modules\\telegraf", "author": { "name": "James Halliday", "email": "mail@substack.net", diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/readme.markdown b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/readme.markdown new file mode 100644 index 000000000..5fd97ab11 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/readme.markdown @@ -0,0 +1,95 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.log(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: + + ``` + > require('./')('one two three -- four five --six'.split(' '), { '--': true }) + { _: [ 'one', 'two', 'three' ], + '--': [ 'four', 'five', '--six' ] } + ``` + + Note that with `opts['--']` set, parsing for arguments still stops after the + `--`. + +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/TaskServer/node_modules/minimist/test/all_bool.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/all_bool.js similarity index 100% rename from TaskServer/node_modules/minimist/test/all_bool.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/all_bool.js diff --git a/TaskServer/node_modules/minimist/test/bool.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/bool.js similarity index 100% rename from TaskServer/node_modules/minimist/test/bool.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/bool.js diff --git a/TaskServer/node_modules/minimist/test/dash.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/dash.js similarity index 100% rename from TaskServer/node_modules/minimist/test/dash.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/dash.js diff --git a/TaskServer/node_modules/minimist/test/default_bool.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/default_bool.js similarity index 100% rename from TaskServer/node_modules/minimist/test/default_bool.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/default_bool.js diff --git a/TaskServer/node_modules/minimist/test/dotted.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/dotted.js similarity index 100% rename from TaskServer/node_modules/minimist/test/dotted.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/dotted.js diff --git a/TaskServer/node_modules/minimist/test/kv_short.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/kv_short.js similarity index 100% rename from TaskServer/node_modules/minimist/test/kv_short.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/kv_short.js diff --git a/TaskServer/node_modules/minimist/test/long.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/long.js similarity index 100% rename from TaskServer/node_modules/minimist/test/long.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/long.js diff --git a/TaskServer/node_modules/minimist/test/num.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/num.js similarity index 100% rename from TaskServer/node_modules/minimist/test/num.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/num.js diff --git a/TaskServer/node_modules/minimist/test/parse.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/parse.js similarity index 100% rename from TaskServer/node_modules/minimist/test/parse.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/parse.js diff --git a/TaskServer/node_modules/minimist/test/parse_modified.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/parse_modified.js similarity index 100% rename from TaskServer/node_modules/minimist/test/parse_modified.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/parse_modified.js diff --git a/TaskServer/node_modules/minimist/test/proto.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/proto.js similarity index 100% rename from TaskServer/node_modules/minimist/test/proto.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/proto.js diff --git a/TaskServer/node_modules/minimist/test/short.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/short.js similarity index 100% rename from TaskServer/node_modules/minimist/test/short.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/short.js diff --git a/TaskServer/node_modules/minimist/test/stop_early.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/stop_early.js similarity index 100% rename from TaskServer/node_modules/minimist/test/stop_early.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/stop_early.js diff --git a/TaskServer/node_modules/minimist/test/unknown.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/unknown.js similarity index 100% rename from TaskServer/node_modules/minimist/test/unknown.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/unknown.js diff --git a/TaskServer/node_modules/minimist/test/whitespace.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/whitespace.js similarity index 100% rename from TaskServer/node_modules/minimist/test/whitespace.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/minimist/test/whitespace.js diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/LICENSE b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/LICENSE new file mode 100644 index 000000000..3a091022c --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018, Nick Gavrilov + +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. \ No newline at end of file diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/README.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/README.md new file mode 100644 index 000000000..c23793c48 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/README.md @@ -0,0 +1,159 @@ +# module-alias +[![NPM Version][npm-image]][npm-url] +[![Build Status][travis-image]][travis-url] + +Create aliases of directories and register custom module paths in NodeJS like a boss! + +No more shit-coding paths in Node like so: + +```js +require('../../../../some/very/deep/module') +``` +Enough of this madness! + +Just create an alias and do it the right way: + +```js +var module = require('@deep/module') +// Or ES6 +import module from '@deep/module' +``` + +It also allows you to register directories that will act just like `node_modules` but with your own private modules, so that you can access them directly: + +```js +require('my_private_module'); +// Or ES6 +import module from 'my_private_module' +``` + +**WARNING:** This module should not be used in other npm modules since it modifies the default `require` behavior! It is designed to be used for development of final projects i.e. web-sites, applications etc. + +## Install + +``` +npm i --save module-alias +``` + +## Usage + +Add your custom configuration to your `package.json` (in your application's root) + +```js +// Aliases +"_moduleAliases": { + "@root" : ".", // Application's root + "@deep" : "src/some/very/deep/directory/or/file", + "@my_module" : "lib/some-file.js", + "something" : "src/foo", // Or without @. Actually, it could be any string +} + +// Custom module directories, just like `node_modules` but with your private modules (optional) +"_moduleDirectories": ["node_modules_custom"], +``` + +Then add this line at the very main file of your app, before any code + +```js +require('module-alias/register') +``` + +**And you're all set!** Now you can do stuff like: + +```js +require('something') +const module = require('@root/some-module') +const veryDeepModule = require('@deep/my-module') +const customModule = require('my_private_module') // module from `node_modules_custom` directory + +// Or ES6 +import 'something' +import module from '@root/some-module' +import veryDeepModule from '@deep/my-module' +import customModule from 'my_private_module' // module from `node_modules_custom` directory +``` + +## Advanced usage + +If you don't want to modify your `package.json` or you just prefer to set it all up programmatically, then the following methods are available for you: + +* `addAlias('alias', 'target_path')` - register a single alias +* `addAliases({ 'alias': 'target_path', ... }) ` - register multiple aliases +* `addPath(path)` - Register custom modules directory (like node_modules, but with your own modules) + +_Examples:_ +```js +const moduleAlias = require('module-alias') + +// +// Register alias +// +moduleAlias.addAlias('@client', __dirname + '/src/client') + +// Or multiple aliases +moduleAlias.addAliases({ + '@root' : __dirname, + '@client': __dirname + '/src/client', + ... +}) + +// Custom handler function (starting from v2.1) +moduleAlias.addAlias('@src', (fromPath, request, alias) => { + // fromPath - Full path of the file from which `require` was called + // request - The path (first argument) that was passed into `require` + // alias - The same alias that was passed as first argument to `addAlias` (`@src` in this case) + + // Return any custom target path for the `@src` alias depending on arguments + if (fromPath.startsWith(__dirname + '/others')) return __dirname + '/others' + return __dirname + '/src' +}) + +// +// Register custom modules directory +// +moduleAlias.addPath(__dirname + '/node_modules_custom') +moduleAlias.addPath(__dirname + '/src') + +// +// Import settings from a specific package.json +// +moduleAlias(__dirname + '/package.json') + +// Or let module-alias to figure where your package.json is +// located. By default it will look in the same directory +// where you have your node_modules (application's root) +moduleAlias() +``` + +## Usage with WebPack + +Luckily, WebPack has a built in support for aliases and custom modules directories so it's easy to make it work on the client side as well! + +```js +// webpack.config.js +const npm_package = require('./package.json') + +module.exports = { + entry: { ... }, + resolve: { + root: __dirname, + alias: npm_package._moduleAliases || {}, + modules: npm_package._moduleDirectories || [] // eg: ["node_modules", "node_modules_custom", "src"] + } +} +``` + +## How it works? + +In order to register an alias it modifies the internal `Module._resolveFilename` method so that when you use `require` or `import` it first checks whether the given string starts with one of the registered aliases, if so, it replaces the alias in the string with the target path of the alias. + +In order to register a custom modules path (`addPath`) it modifies the internal `Module._nodeModulePaths` method so that the given directory then acts like it's the `node_modules` directory. + +[npm-image]: https://img.shields.io/npm/v/module-alias.svg +[npm-url]: https://npmjs.org/package/module-alias +[travis-image]: https://img.shields.io/travis/ilearnio/module-alias/master.svg +[travis-url]: https://travis-ci.org/ilearnio/module-alias + +## Refactor your code (for already existing projects) + +If you are using this on an existing project, you can use [relative-to-alias](https://github.com/s-yadav/relative-to-alias) to refactor your code to start using aliases. diff --git a/TaskServer/node_modules/module-alias/index.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/index.js similarity index 100% rename from TaskServer/node_modules/module-alias/index.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/index.js diff --git a/TaskServer/node_modules/module-alias/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/package.json similarity index 94% rename from TaskServer/node_modules/module-alias/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/package.json index c2d2a5eea..9d615b821 100644 --- a/TaskServer/node_modules/module-alias/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", "_shasum": "151cdcecc24e25739ff0aa6e51e1c5716974c0e0", "_spec": "module-alias@^2.2.2", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer\\node_modules\\telegraf", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements\\node_modules\\telegraf", "author": { "name": "Nick Gavrilov", "email": "artnikpro@gmail.com" diff --git a/TaskServer/node_modules/module-alias/register.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/register.js similarity index 100% rename from TaskServer/node_modules/module-alias/register.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/module-alias/register.js diff --git a/TaskServer/node_modules/ms/index.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/index.js similarity index 100% rename from TaskServer/node_modules/ms/index.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/index.js diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/license.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/license.md new file mode 100644 index 000000000..69b61253a --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +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/TaskServer/node_modules/ms/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/package.json similarity index 84% rename from TaskServer/node_modules/ms/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/package.json index ad7908279..5c17e2e8a 100644 --- a/TaskServer/node_modules/ms/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/package.json @@ -1,27 +1,27 @@ { - "_from": "ms@^2.1.1", + "_from": "ms@2.1.2", "_id": "ms@2.1.2", "_inBundle": false, "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "_location": "/ms", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "ms@^2.1.1", + "raw": "ms@2.1.2", "name": "ms", "escapedName": "ms", - "rawSpec": "^2.1.1", + "rawSpec": "2.1.2", "saveSpec": null, - "fetchSpec": "^2.1.1" + "fetchSpec": "2.1.2" }, "_requiredBy": [ "/debug" ], "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", - "_spec": "ms@^2.1.1", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer\\node_modules\\debug", + "_spec": "ms@2.1.2", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements\\node_modules\\debug", "bugs": { "url": "https://github.com/zeit/ms/issues" }, diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/readme.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/readme.md new file mode 100644 index 000000000..9a1996b17 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/CHANGELOG.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/CHANGELOG.md new file mode 100644 index 000000000..543d3d947 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/CHANGELOG.md @@ -0,0 +1,272 @@ + +Changelog +========= + + +# 2.x release + +## v2.6.1 + +**This is an important security release. It is strongly recommended to update as soon as possible.** + +- Fix: honor the `size` option after following a redirect. + +## v2.6.0 + +- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information. +- Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body. +- Fix: `Response.url` should return empty string instead of `null` by default. + +## v2.5.0 + +- Enhance: `Response` object now includes `redirected` property. +- Enhance: `fetch()` now accepts third-party `Blob` implementation as body. +- Other: disable `package-lock.json` generation as we never commit them. +- Other: dev dependency update. +- Other: readme update. + +## v2.4.1 + +- Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export. + +## v2.4.0 + +- Enhance: added `Brotli` compression support (using node's zlib). +- Enhance: updated `Blob` implementation per spec. +- Fix: set content type automatically for `URLSearchParams`. +- Fix: `Headers` now reject empty header names. +- Fix: test cases, as node 12+ no longer accepts invalid header response. + +## v2.3.0 + +- Enhance: added `AbortSignal` support, with README example. +- Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`. +- Fix: update `browser.js` to support react-native environment, where `self` isn't available globally. + +## v2.2.1 + +- Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header. +- Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag. +- Other: Better README. + +## v2.2.0 + +- Enhance: Support all `ArrayBuffer` view types +- Enhance: Support Web Workers +- Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file +- Fix: Add `__esModule` property to the exports object +- Other: Better example in README for writing response to a file +- Other: More tests for Agent + +## v2.1.2 + +- Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects +- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size +- Fix: support custom `Host` headers with any casing +- Fix: support importing `fetch()` from TypeScript in `browser.js` +- Fix: handle the redirect response body properly + +## v2.1.1 + +Fix packaging errors in v2.1.0. + +## v2.1.0 + +- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request` +- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner +- Fix: silently ignore invalid HTTP headers +- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses +- Fix: include bodies when following a redirection when appropriate + +## v2.0.0 + +This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2. + +### General changes + +- Major: Node.js 0.10.x and 0.12.x support is dropped +- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports +- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable +- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup) +- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings +- Other: rewrite in ES2015 using Babel +- Other: use Codecov for code coverage tracking +- Other: update package.json script for npm 5 +- Other: `encoding` module is now optional (alpha.7) +- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9) +- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9) + +### HTTP requests + +- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec) +- Fix: errors in a response are caught before the body is accessed +- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+ + +### Response and Request classes + +- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior +- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2) +- Major: internal methods are no longer exposed +- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec) +- Enhance: add `response.arrayBuffer()` (also applies to Requests) +- Enhance: add experimental `response.blob()` (also applies to Requests) +- Enhance: `URLSearchParams` is now accepted as a body +- Enhance: wrap `response.json()` json parsing error as `FetchError` +- Fix: fix Request and Response with `null` body + +### Headers class + +- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec) +- Enhance: make Headers iterable +- Enhance: make Headers constructor accept an array of tuples +- Enhance: make sure header names and values are valid in HTTP +- Fix: coerce Headers prototype function parameters to strings, where applicable + +### Documentation + +- Enhance: more comprehensive API docs +- Enhance: add a list of default headers in README + + +# 1.x release + +## backport releases (v1.7.0 and beyond) + +See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details. + +## v1.6.3 + +- Enhance: error handling document to explain `FetchError` design +- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0) + +## v1.6.2 + +- Enhance: minor document update +- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error + +## v1.6.1 + +- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string +- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance +- Fix: documentation update + +## v1.6.0 + +- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer +- Enhance: better old server support by handling raw deflate response +- Enhance: skip encoding detection for non-HTML/XML response +- Enhance: minor document update +- Fix: HEAD request doesn't need decompression, as body is empty +- Fix: `req.body` now accepts a Node.js buffer + +## v1.5.3 + +- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate +- Fix: allow resolving response and cloned response in any order +- Fix: avoid setting `content-length` when `form-data` body use streams +- Fix: send DELETE request with content-length when body is present +- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch + +## v1.5.2 + +- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent + +## v1.5.1 + +- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection + +## v1.5.0 + +- Enhance: rejected promise now use custom `Error` (thx to @pekeler) +- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) +- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR) + +## v1.4.1 + +- Fix: wrapping Request instance with FormData body again should preserve the body as-is + +## v1.4.0 + +- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR) +- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin) +- Enhance: Body constructor has been refactored out (thx to @kirill-konshin) +- Enhance: Headers now has `forEach` method (thx to @tricoder42) +- Enhance: back to 100% code coverage +- Fix: better form-data support (thx to @item4) +- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR) + +## v1.3.3 + +- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests +- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header +- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec +- Fix: `Request` and `Response` constructors now parse headers input using `Headers` + +## v1.3.2 + +- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature) + +## v1.3.1 + +- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side) + +## v1.3.0 + +- Enhance: now `fetch.Request` is exposed as well + +## v1.2.1 + +- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes + +## v1.2.0 + +- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier + +## v1.1.2 + +- Fix: `Headers` should only support `String` and `Array` properties, and ignore others + +## v1.1.1 + +- Enhance: now req.headers accept both plain object and `Headers` instance + +## v1.1.0 + +- Enhance: timeout now also applies to response body (in case of slow response) +- Fix: timeout is now cleared properly when fetch is done/has failed + +## v1.0.6 + +- Fix: less greedy content-type charset matching + +## v1.0.5 + +- Fix: when `follow = 0`, fetch should not follow redirect +- Enhance: update tests for better coverage +- Enhance: code formatting +- Enhance: clean up doc + +## v1.0.4 + +- Enhance: test iojs support +- Enhance: timeout attached to socket event only fire once per redirect + +## v1.0.3 + +- Fix: response size limit should reject large chunk +- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD) + +## v1.0.2 + +- Fix: added res.ok per spec change + +## v1.0.0 + +- Enhance: better test coverage and doc + + +# 0.x release + +## v0.1 + +- Major: initial public release diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/LICENSE.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/LICENSE.md new file mode 100644 index 000000000..660ffecb5 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/LICENSE.md @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2016 David Frank + +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/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/README.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/README.md new file mode 100644 index 000000000..2dde74289 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/README.md @@ -0,0 +1,590 @@ +node-fetch +========== + +[![npm version][npm-image]][npm-url] +[![build status][travis-image]][travis-url] +[![coverage status][codecov-image]][codecov-url] +[![install size][install-size-image]][install-size-url] +[![Discord][discord-image]][discord-url] + +A light-weight module that brings `window.fetch` to Node.js + +(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567)) + +[![Backers][opencollective-image]][opencollective-url] + + + +- [Motivation](#motivation) +- [Features](#features) +- [Difference from client-side fetch](#difference-from-client-side-fetch) +- [Installation](#installation) +- [Loading and configuring the module](#loading-and-configuring-the-module) +- [Common Usage](#common-usage) + - [Plain text or HTML](#plain-text-or-html) + - [JSON](#json) + - [Simple Post](#simple-post) + - [Post with JSON](#post-with-json) + - [Post with form parameters](#post-with-form-parameters) + - [Handling exceptions](#handling-exceptions) + - [Handling client and server errors](#handling-client-and-server-errors) +- [Advanced Usage](#advanced-usage) + - [Streams](#streams) + - [Buffer](#buffer) + - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data) + - [Extract Set-Cookie Header](#extract-set-cookie-header) + - [Post data using a file stream](#post-data-using-a-file-stream) + - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart) + - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal) +- [API](#api) + - [fetch(url[, options])](#fetchurl-options) + - [Options](#options) + - [Class: Request](#class-request) + - [Class: Response](#class-response) + - [Class: Headers](#class-headers) + - [Interface: Body](#interface-body) + - [Class: FetchError](#class-fetcherror) +- [License](#license) +- [Acknowledgement](#acknowledgement) + + + +## Motivation + +Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. + +See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side). + +## Features + +- Stay consistent with `window.fetch` API. +- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences. +- Use native promise but allow substituting it with [insert your favorite promise library]. +- Use native Node streams for body on both request and response. +- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically. +- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting. + +## Difference from client-side fetch + +- See [Known Differences](LIMITS.md) for details. +- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue. +- Pull requests are welcomed too! + +## Installation + +Current stable release (`2.x`) + +```sh +$ npm install node-fetch +``` + +## Loading and configuring the module +We suggest you load the module via `require` until the stabilization of ES modules in node: +```js +const fetch = require('node-fetch'); +``` + +If you are using a Promise library other than native, set it through `fetch.Promise`: +```js +const Bluebird = require('bluebird'); + +fetch.Promise = Bluebird; +``` + +## Common Usage + +NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences. + +#### Plain text or HTML +```js +fetch('https://github.com/') + .then(res => res.text()) + .then(body => console.log(body)); +``` + +#### JSON + +```js + +fetch('https://api.github.com/users/github') + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Simple Post +```js +fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' }) + .then(res => res.json()) // expecting a json response + .then(json => console.log(json)); +``` + +#### Post with JSON + +```js +const body = { a: 1 }; + +fetch('https://httpbin.org/post', { + method: 'post', + body: JSON.stringify(body), + headers: { 'Content-Type': 'application/json' }, + }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Post with form parameters +`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods. + +NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such: + +```js +const { URLSearchParams } = require('url'); + +const params = new URLSearchParams(); +params.append('a', 1); + +fetch('https://httpbin.org/post', { method: 'POST', body: params }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Handling exceptions +NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information. + +Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details. + +```js +fetch('https://domain.invalid/') + .catch(err => console.error(err)); +``` + +#### Handling client and server errors +It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses: + +```js +function checkStatus(res) { + if (res.ok) { // res.status >= 200 && res.status < 300 + return res; + } else { + throw MyCustomError(res.statusText); + } +} + +fetch('https://httpbin.org/status/400') + .then(checkStatus) + .then(res => console.log('will not get here...')) +``` + +## Advanced Usage + +#### Streams +The "Node.js way" is to use streams when possible: + +```js +fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') + .then(res => { + const dest = fs.createWriteStream('./octocat.png'); + res.body.pipe(dest); + }); +``` + +#### Buffer +If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API) + +```js +const fileType = require('file-type'); + +fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') + .then(res => res.buffer()) + .then(buffer => fileType(buffer)) + .then(type => { /* ... */ }); +``` + +#### Accessing Headers and other Meta data +```js +fetch('https://github.com/') + .then(res => { + console.log(res.ok); + console.log(res.status); + console.log(res.statusText); + console.log(res.headers.raw()); + console.log(res.headers.get('content-type')); + }); +``` + +#### Extract Set-Cookie Header + +Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API. + +```js +fetch(url).then(res => { + // returns an array of values, instead of a string of comma-separated values + console.log(res.headers.raw()['set-cookie']); +}); +``` + +#### Post data using a file stream + +```js +const { createReadStream } = require('fs'); + +const stream = createReadStream('input.txt'); + +fetch('https://httpbin.org/post', { method: 'POST', body: stream }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Post with form-data (detect multipart) + +```js +const FormData = require('form-data'); + +const form = new FormData(); +form.append('a', 1); + +fetch('https://httpbin.org/post', { method: 'POST', body: form }) + .then(res => res.json()) + .then(json => console.log(json)); + +// OR, using custom headers +// NOTE: getHeaders() is non-standard API + +const form = new FormData(); +form.append('a', 1); + +const options = { + method: 'POST', + body: form, + headers: form.getHeaders() +} + +fetch('https://httpbin.org/post', options) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Request cancellation with AbortSignal + +> NOTE: You may cancel streamed requests only on Node >= v8.0.0 + +You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller). + +An example of timing out a request after 150ms could be achieved as the following: + +```js +import AbortController from 'abort-controller'; + +const controller = new AbortController(); +const timeout = setTimeout( + () => { controller.abort(); }, + 150, +); + +fetch(url, { signal: controller.signal }) + .then(res => res.json()) + .then( + data => { + useData(data) + }, + err => { + if (err.name === 'AbortError') { + // request was aborted + } + }, + ) + .finally(() => { + clearTimeout(timeout); + }); +``` + +See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples. + + +## API + +### fetch(url[, options]) + +- `url` A string representing the URL for fetching +- `options` [Options](#fetch-options) for the HTTP(S) request +- Returns: Promise<[Response](#class-response)> + +Perform an HTTP(S) fetch. + +`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`. + + +### Options + +The default values are shown after each option key. + +```js +{ + // These properties are part of the Fetch Standard + method: 'GET', + headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below) + body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream + redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect + signal: null, // pass an instance of AbortSignal to optionally abort requests + + // The following properties are node-fetch extensions + follow: 20, // maximum redirect count. 0 to not follow redirect + timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead. + compress: true, // support gzip/deflate content encoding. false to disable + size: 0, // maximum response body size in bytes. 0 to disable + agent: null // http(s).Agent instance or function that returns an instance (see below) +} +``` + +##### Default Headers + +If no values are set, the following request headers will be sent automatically: + +Header | Value +------------------- | -------------------------------------------------------- +`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ +`Accept` | `*/*` +`Connection` | `close` _(when no `options.agent` is present)_ +`Content-Length` | _(automatically calculated, if possible)_ +`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ +`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)` + +Note: when `body` is a `Stream`, `Content-Length` is not set automatically. + +##### Custom Agent + +The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following: + +- Support self-signed certificate +- Use only IPv4 or IPv6 +- Custom DNS Lookup + +See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information. + +In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol. + +```js +const httpAgent = new http.Agent({ + keepAlive: true +}); +const httpsAgent = new https.Agent({ + keepAlive: true +}); + +const options = { + agent: function (_parsedURL) { + if (_parsedURL.protocol == 'http:') { + return httpAgent; + } else { + return httpsAgent; + } + } +} +``` + + +### Class: Request + +An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface. + +Due to the nature of Node.js, the following properties are not implemented at this moment: + +- `type` +- `destination` +- `referrer` +- `referrerPolicy` +- `mode` +- `credentials` +- `cache` +- `integrity` +- `keepalive` + +The following node-fetch extension properties are provided: + +- `follow` +- `compress` +- `counter` +- `agent` + +See [options](#fetch-options) for exact meaning of these extensions. + +#### new Request(input[, options]) + +*(spec-compliant)* + +- `input` A string representing a URL, or another `Request` (which will be cloned) +- `options` [Options][#fetch-options] for the HTTP(S) request + +Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). + +In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object. + + +### Class: Response + +An HTTP(S) response. This class implements the [Body](#iface-body) interface. + +The following properties are not implemented in node-fetch at this moment: + +- `Response.error()` +- `Response.redirect()` +- `type` +- `trailer` + +#### new Response([body[, options]]) + +*(spec-compliant)* + +- `body` A `String` or [`Readable` stream][node-readable] +- `options` A [`ResponseInit`][response-init] options dictionary + +Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response). + +Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly. + +#### response.ok + +*(spec-compliant)* + +Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. + +#### response.redirected + +*(spec-compliant)* + +Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0. + + +### Class: Headers + +This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented. + +#### new Headers([init]) + +*(spec-compliant)* + +- `init` Optional argument to pre-fill the `Headers` object + +Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object. + +```js +// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class + +const meta = { + 'Content-Type': 'text/xml', + 'Breaking-Bad': '<3' +}; +const headers = new Headers(meta); + +// The above is equivalent to +const meta = [ + [ 'Content-Type', 'text/xml' ], + [ 'Breaking-Bad', '<3' ] +]; +const headers = new Headers(meta); + +// You can in fact use any iterable objects, like a Map or even another Headers +const meta = new Map(); +meta.set('Content-Type', 'text/xml'); +meta.set('Breaking-Bad', '<3'); +const headers = new Headers(meta); +const copyOfHeaders = new Headers(headers); +``` + + +### Interface: Body + +`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes. + +The following methods are not yet implemented in node-fetch at this moment: + +- `formData()` + +#### body.body + +*(deviation from spec)* + +* Node.js [`Readable` stream][node-readable] + +Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable]. + +#### body.bodyUsed + +*(spec-compliant)* + +* `Boolean` + +A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again. + +#### body.arrayBuffer() +#### body.blob() +#### body.json() +#### body.text() + +*(spec-compliant)* + +* Returns: Promise + +Consume the body and return a promise that will resolve to one of these formats. + +#### body.buffer() + +*(node-fetch extension)* + +* Returns: Promise<Buffer> + +Consume the body and return a promise that will resolve to a Buffer. + +#### body.textConverted() + +*(node-fetch extension)* + +* Returns: Promise<String> + +Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible. + +(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.) + + +### Class: FetchError + +*(node-fetch extension)* + +An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info. + + +### Class: AbortError + +*(node-fetch extension)* + +An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info. + +## Acknowledgement + +Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference. + +`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr). + +## License + +MIT + +[npm-image]: https://flat.badgen.net/npm/v/node-fetch +[npm-url]: https://www.npmjs.com/package/node-fetch +[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch +[travis-url]: https://travis-ci.org/bitinn/node-fetch +[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master +[codecov-url]: https://codecov.io/gh/bitinn/node-fetch +[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch +[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch +[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square +[discord-url]: https://discord.gg/Zxbndcm +[opencollective-image]: https://opencollective.com/node-fetch/backers.svg +[opencollective-url]: https://opencollective.com/node-fetch +[whatwg-fetch]: https://fetch.spec.whatwg.org/ +[response-init]: https://fetch.spec.whatwg.org/#responseinit +[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams +[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers +[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md +[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md +[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md diff --git a/TaskServer/node_modules/node-fetch/browser.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/browser.js similarity index 90% rename from TaskServer/node_modules/node-fetch/browser.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/browser.js index 0ad5de004..83c54c584 100644 --- a/TaskServer/node_modules/node-fetch/browser.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/browser.js @@ -16,7 +16,9 @@ var global = getGlobal(); module.exports = exports = global.fetch; // Needed for TypeScript and Webpack. -exports.default = global.fetch.bind(global); +if (global.fetch) { + exports.default = global.fetch.bind(global); +} exports.Headers = global.Headers; exports.Request = global.Request; diff --git a/TaskServer/node_modules/node-fetch/lib/index.es.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/lib/index.es.js similarity index 99% rename from TaskServer/node_modules/node-fetch/lib/index.es.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/lib/index.es.js index 37d022c91..61906c959 100644 --- a/TaskServer/node_modules/node-fetch/lib/index.es.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/lib/index.es.js @@ -461,6 +461,12 @@ function convertBody(buffer, headers) { // html4 if (!res && str) { res = / 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parse_url(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parse_url(`${input}`); + } + input = {}; + } else { + parsedURL = parse_url(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close'); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; +const resolve_url = Url.resolve; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + request.body.destroy(error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + finalize(); + }); + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + const locationURL = location === null ? null : resolve_url(request.url, location); + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +export default fetch; +export { Headers, Request, Response, FetchError }; diff --git a/TaskServer/node_modules/node-fetch/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/package.json similarity index 87% rename from TaskServer/node_modules/node-fetch/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/package.json index dcd996399..3c6b28cd7 100644 --- a/TaskServer/node_modules/node-fetch/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/node-fetch/package.json @@ -1,8 +1,8 @@ { "_from": "node-fetch@^2.2.0", - "_id": "node-fetch@2.6.0", + "_id": "node-fetch@2.6.1", "_inBundle": false, - "_integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "_integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "_location": "/node-fetch", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/telegraf" ], - "_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "_shasum": "e633456386d4aa55863f676a7ab0daa8fdecb0fd", + "_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "_shasum": "045bd323631f76ed2e2b55573394416b639a0052", "_spec": "node-fetch@^2.2.0", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer\\node_modules\\telegraf", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements\\node_modules\\telegraf", "author": { "name": "David Frank" }, @@ -89,5 +89,5 @@ "report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js", "test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js" }, - "version": "2.6.0" + "version": "2.6.1" } diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/.editorconfig b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/.editorconfig new file mode 100644 index 000000000..e2dccfde9 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/.editorconfig @@ -0,0 +1,13 @@ +# editorconfig.org +root = true + +[*] +indent_size = 4 +indent_style = space +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/LICENCE b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/LICENCE new file mode 100644 index 000000000..00df77022 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/LICENCE @@ -0,0 +1,13 @@ +Copyright 2013 Paul Connolley (connrs) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/README.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/README.md new file mode 100644 index 000000000..6dfbc71ac --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/README.md @@ -0,0 +1,58 @@ +# SandwichStream + +[![npm](https://img.shields.io/npm/v/sandwich-stream.svg?style=flat-square)](https://www.npmjs.com/package/sandwich-stream) +[![npm](https://img.shields.io/npm/dt/sandwich-stream.svg?style=flat-square)](https://www.npmjs.com/package/sandwich-stream) +[![Travis CI](https://img.shields.io/travis/connrs/node-sandwich-stream.svg?style=flat-square)](https://travis-ci.org/connrs/node-sandwich-stream) +[![codecov](https://img.shields.io/codecov/c/github/connrs/node-sandwich-stream.svg?style=flat-square)](https://codecov.io/gh/connrs/node-sandwich-stream) +[![Codacy Badge](https://img.shields.io/codacy/grade/6d64b00364bf413980280bd4e55d6115.svg?style=flat-square)](https://www.codacy.com/project/connrs/node-sandwich-stream/dashboard?utm_source=github.com&utm_medium=referral&utm_content=connrs/node-sandwich-stream&utm_campaign=Badge_Grade_Dashboard) +[![Dependencies](https://david-dm.org/connrs/node-sandwich-stream.svg?style=flat-square)](https://codeclimate.com/github/connrs/node-sandwich-stream/master/package.json) +[![Known Vulnerabilities](https://snyk.io/test/github/connrs/node-sandwich-stream/badge.svg?style=flat-square&targetFile=package.json)](https://snyk.io/test/github/connrs/node-sandwich-stream?targetFile=package.json) +[![Maintainability](https://api.codeclimate.com/v1/badges/a6a00d50601938edfdad/maintainability)](https://codeclimate.com/github/connrs/node-sandwich-stream/maintainability) + +## About +While I'm not overjoyed about how performant the internals will operate, I wanted a readable stream that was ACTUALLY A READABLE STREAM. Not a streams1 stream masquerading as streams2. As soon as somebody writes a better concat stream as a readable stream with a nice simple API, this baby is going to develop some serious abandonment issues. + +## Installation +```bash +npm install sandwich-stream --save +``` + +**note**: this code was made using it [TypeScript](https://www.typescriptlang.org/), and its typings are linked in [package.json](./package.json), so there's no need of installing _@types/sandwich-stream_ or anything related. + +## Usage +```typescript +import { SandwichStream } from 'sandwich-stream'; +// OR EVEN: +// const SandwichStream = require('sandwich-stream'); + +const sandwich = SandwichStream({ + head: 'Thing at the top\n', + tail: '\nThing at the bottom', + separator: '\n ---- \n' +}); + +sandwich.add(aStreamIPreparedEarlier) + .add(anotherStreamIPreparedEarlier) + .add(aFurtherStreamIPreparedEarlier) + .pipe(process.stdout); + +// The thing at the top +// ---- +// Stream1 +// ---- +// Stream2 +// ---- +// Stream3 +// The thing at the bottom +``` +## Configuration Options +* `head` option takes a string/buffer and pushes the string before all other content +* `foot` option takes a string/buffer and pushes the string after all other data has been pushed +* `separator` option pushes a string/buffer between each stream +* [Readable Options](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/be662c475da091788139b486a55708f02e2880b6/types/node/index.d.ts#L6485) can also be passed through. + +## API +Too add a stream use the **.add** method: `sandwich.add(streamVariable);` + +## More +Wanna known more about Node Streams? Read [this](https://medium.freecodecamp.org/node-js-streams-everything-you-need-to-know-c9141306be93). diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.d.ts new file mode 100644 index 000000000..da28ff3a7 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.d.ts @@ -0,0 +1,107 @@ +/// +import { Readable, ReadableOptions } from 'stream'; +/** + * Sandwich Options that will configure parsed data + */ +export interface SandwichOptions extends ReadableOptions { + readonly head?: string | Buffer; + readonly tail?: string | Buffer; + readonly separator?: string | Buffer; +} +/** + * Handles Readable streams requests as concatenation through data handling as + * well adding tags it each begin, end and between of the streams + */ +export declare class SandwichStream extends Readable { + private streamsActive; + private streams; + private newStreams; + private head; + private tail; + private separator; + private currentStream; + /** + * Initiates the SandwichStream, you can consider it also passing + * ReadableOptions to it + * + * @param head Pushes this content before all other content + * @param tail Pushes this content after all other data has been pushed + * @param separator Pushes this content between each stream + * @param remaining The other kind of options to be passed to Readable + * @example + * const ss = new SandwichStream({ + * head: 'This at the top\n', + * tail: '\nThis at the bottom', + * separator: '\n --- \n' + * }); + */ + constructor({ head, tail, separator, ...remaining }: SandwichOptions); + /** + * Add a new Readable stream in the queue + * + * @param newStream The Readable stream + * @example + * sandwichStream.add(streamOne); + * sandwichStream.add(streamTwo); + * sandwichStream.add(streamThree); + * @throws An Error in case that this request was not accepted + * @returns This instance of Sandwich Stream + */ + add(newStream: Readable): this; + /** + * Works in a similar way from the Readable read, only that this one checks + * for whether or not a stream is already being handled + * @returns This instance of Sandwich Stream + */ + _read(): void; + /** + * Binds an error thrown from one of the streams being handled + * + * @param err Error to be bind + * @returns This instance of Sandwich Stream + */ + private subStreamOnError; + /** + * Fetches the next stream to be handled + * @returns This instance of Sandwich Stream + */ + private streamNextStream; + /** + * Verifies whether or not the stream queue has ended + * @returns This instance of Sandwich Stream + */ + private nextStream; + /** + * Once the current stream starts to pass their data, this handles it in a + * less complicated way + * @returns This instance of Sandwich Stream + */ + private bindCurrentStreamEvents; + /** + * Handles the data from a current stream once they are being streamed + * @returns This instance of Sandwich Stream + */ + private currentStreamOnReadable; + /** + * Handles the tagging once a stream is finished + * @returns This instance of Sandwich Stream + */ + private currentStreamOnEnd; + /** + * Adds the head tag to the Sandwich Stream + * @returns This instance of Sandwich Stream + */ + private pushHead; + /** + * Adds the separator tag to the Sandwich Stream + * @returns This instance of Sandwich Stream + */ + private pushSeparator; + /** + * Adds the tail tag to the Sandwich Stream + * @returns This instance of Sandwich Stream + */ + private pushTail; +} +export default SandwichStream; +//# sourceMappingURL=sandwich-stream.d.ts.map \ No newline at end of file diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.d.ts.map b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.d.ts.map new file mode 100644 index 000000000..2a9f3a4fb --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sandwich-stream.d.ts","sourceRoot":"","sources":["src/sandwich-stream.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACpD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACxC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,aAAa,CAAyB;IAE9C;;;;;;;;;;;;;;OAcG;gBACS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,eAAe;IAQpE;;;;;;;;;;OAUG;IACI,GAAG,CAAC,SAAS,EAAE,QAAQ,GAAG,IAAI;IAWrC;;;;OAIG;IACI,KAAK,IAAI,IAAI;IAQpB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAOlB;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAK/B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAO/B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAMhB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAMrB;;;OAGG;IACH,OAAO,CAAC,QAAQ;CAKnB;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/TaskServer/node_modules/sandwich-stream/dist/sandwich-stream.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.js similarity index 100% rename from TaskServer/node_modules/sandwich-stream/dist/sandwich-stream.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.js diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.mjs b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.mjs new file mode 100644 index 000000000..2cba06618 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/dist/sandwich-stream.mjs @@ -0,0 +1,181 @@ +import { Readable } from 'stream'; + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +} + +/** + * Handles Readable streams requests as concatenation through data handling as + * well adding tags it each begin, end and between of the streams + */ +class SandwichStream extends Readable { + /** + * Initiates the SandwichStream, you can consider it also passing + * ReadableOptions to it + * + * @param head Pushes this content before all other content + * @param tail Pushes this content after all other data has been pushed + * @param separator Pushes this content between each stream + * @param remaining The other kind of options to be passed to Readable + * @example + * const ss = new SandwichStream({ + * head: 'This at the top\n', + * tail: '\nThis at the bottom', + * separator: '\n --- \n' + * }); + */ + constructor(_a) { + var { head, tail, separator } = _a, remaining = __rest(_a, ["head", "tail", "separator"]); + super(remaining); + this.streamsActive = false; + this.streams = []; + this.newStreams = []; + this.currentStream = null; + this.head = (null !== head && undefined !== head) ? head : null; + this.tail = (null !== tail && undefined !== tail) ? tail : null; + this.separator = (null !== separator && undefined !== separator) ? separator : null; + } + /** + * Add a new Readable stream in the queue + * + * @param newStream The Readable stream + * @example + * sandwichStream.add(streamOne); + * sandwichStream.add(streamTwo); + * sandwichStream.add(streamThree); + * @throws An Error in case that this request was not accepted + * @returns This instance of Sandwich Stream + */ + add(newStream) { + if (false === this.streamsActive) { + this.streams.push(newStream); + newStream.on('error', this.subStreamOnError.bind(this)); + } + else { + this.newStreams.push(newStream); + } + return this; + } + /** + * Works in a similar way from the Readable read, only that this one checks + * for whether or not a stream is already being handled + * @returns This instance of Sandwich Stream + */ + _read() { + if (false === this.streamsActive) { + this.streamsActive = true; + this.pushHead(); + this.streamNextStream(); + } + } + /** + * Binds an error thrown from one of the streams being handled + * + * @param err Error to be bind + * @returns This instance of Sandwich Stream + */ + subStreamOnError(err) { + this.emit('error', err); + } + /** + * Fetches the next stream to be handled + * @returns This instance of Sandwich Stream + */ + streamNextStream() { + if (true === this.nextStream()) { + this.bindCurrentStreamEvents(); + } + else { + this.pushTail(); + this.push(null); + } + } + /** + * Verifies whether or not the stream queue has ended + * @returns This instance of Sandwich Stream + */ + nextStream() { + const tmp = this.streams.shift(); + this.currentStream = (undefined !== tmp) ? tmp : null; + return null !== this.currentStream; + } + /** + * Once the current stream starts to pass their data, this handles it in a + * less complicated way + * @returns This instance of Sandwich Stream + */ + bindCurrentStreamEvents() { + this.currentStream.on('readable', this.currentStreamOnReadable.bind(this)); + this.currentStream.on('end', this.currentStreamOnEnd.bind(this)); + } + /** + * Handles the data from a current stream once they are being streamed + * @returns This instance of Sandwich Stream + */ + currentStreamOnReadable() { + const tmp = this.currentStream.read(); + const data = (undefined !== tmp && null !== tmp) ? tmp : ''; + this.push(data); + } + /** + * Handles the tagging once a stream is finished + * @returns This instance of Sandwich Stream + */ + currentStreamOnEnd() { + this.pushSeparator(); + this.streams.concat(this.newStreams); + this.newStreams = []; + this.streamNextStream(); + } + /** + * Adds the head tag to the Sandwich Stream + * @returns This instance of Sandwich Stream + */ + pushHead() { + if (null !== this.head) { + this.push(this.head); + } + } + /** + * Adds the separator tag to the Sandwich Stream + * @returns This instance of Sandwich Stream + */ + pushSeparator() { + if (0 < this.streams.length && null !== this.separator) { + this.push(this.separator); + } + } + /** + * Adds the tail tag to the Sandwich Stream + * @returns This instance of Sandwich Stream + */ + pushTail() { + if (null !== this.tail) { + this.push(this.tail); + } + } +} + +export default SandwichStream; +export { SandwichStream }; diff --git a/TaskServer/node_modules/sandwich-stream/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/package.json similarity index 95% rename from TaskServer/node_modules/sandwich-stream/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/package.json index af0499dbd..5463bfc17 100644 --- a/TaskServer/node_modules/sandwich-stream/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz", "_shasum": "6d1feb6cf7e9fe9fadb41513459a72c2e84000fa", "_spec": "sandwich-stream@^2.0.1", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer\\node_modules\\telegraf", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements\\node_modules\\telegraf", "author": { "name": "connrs", "url": "https://connrs.uk/" diff --git a/TaskServer/node_modules/sandwich-stream/rollup.config.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/rollup.config.js similarity index 100% rename from TaskServer/node_modules/sandwich-stream/rollup.config.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/sandwich-stream/rollup.config.js diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/LICENSE b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/LICENSE new file mode 100644 index 000000000..43cf7f141 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2019 Vitaly Domnikov + +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/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/bin/telegraf b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/bin/telegraf new file mode 100644 index 000000000..bc45ad33b --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/bin/telegraf @@ -0,0 +1,108 @@ +#!/usr/bin/env node + +const debug = require('debug') +const path = require('path') +const parse = require('minimist') +const { addAlias } = require('module-alias') +const Telegraf = require('../') + +const log = debug('telegraf:cli') + +const help = () => { + console.log(`Usage: telegraf [opts] + -t Bot token [$BOT_TOKEN] + -d Webhook domain + -H Webhook host [0.0.0.0] + -p Webhook port [$PORT or 3000] + -s Stop on error + -l Enable logs + -h Show this help message`) +} + +const args = parse(process.argv, { + alias: { + t: 'token', + d: 'domain', + H: 'host', + h: 'help', + l: 'logs', + s: 'stop', + p: 'port' + }, + boolean: ['h', 'l', 's'], + default: { + H: '0.0.0.0', + p: process.env.PORT || 3000 + } +}) + +if (args.help) { + help() + process.exit(0) +} + +const token = args.token || process.env.BOT_TOKEN +const domain = args.domain || process.env.BOT_DOMAIN +if (!token) { + console.error('Please supply Bot Token') + help() + process.exit(1) +} + +let [, , file] = args._ + +if (!file) { + try { + const packageJson = require(path.resolve(process.cwd(), 'package.json')) + file = packageJson.main || 'index.js' + } catch (err) { + } +} + +if (!file) { + console.error('Please supply a bot handler file.\n') + help() + process.exit(1) +} + +if (file[0] !== '/') { + file = path.resolve(process.cwd(), file) +} + +let botHandler +let httpHandler +let tlsOptions + +try { + if (args.logs) { + debug.enable('telegraf:*') + } + addAlias('telegraf', path.join(__dirname, '../')) + const mod = require(file) + botHandler = mod.botHandler || mod + httpHandler = mod.httpHandler + tlsOptions = mod.tlsOptions +} catch (err) { + console.error(`Error importing ${file}`, err.stack) + process.exit(1) +} + +const config = {} +if (domain) { + config.webhook = { + tlsOptions, + host: args.host, + port: args.port, + domain: domain, + cb: httpHandler + } +} + +const bot = new Telegraf(token) +if (!args.stop) { + bot.catch(log) +} +bot.use(botHandler) + +log(`Starting module ${file}`) +bot.launch(config) diff --git a/TaskServer/node_modules/telegraf/composer.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/composer.js similarity index 100% rename from TaskServer/node_modules/telegraf/composer.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/composer.js diff --git a/TaskServer/node_modules/telegraf/context.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/context.js similarity index 100% rename from TaskServer/node_modules/telegraf/context.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/context.js diff --git a/TaskServer/node_modules/telegraf/core/network/client.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/client.js similarity index 100% rename from TaskServer/node_modules/telegraf/core/network/client.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/client.js diff --git a/TaskServer/node_modules/telegraf/core/network/error.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/error.js similarity index 100% rename from TaskServer/node_modules/telegraf/core/network/error.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/error.js diff --git a/TaskServer/node_modules/telegraf/core/network/multipart-stream.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/multipart-stream.js similarity index 100% rename from TaskServer/node_modules/telegraf/core/network/multipart-stream.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/multipart-stream.js diff --git a/TaskServer/node_modules/telegraf/core/network/webhook.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/webhook.js similarity index 100% rename from TaskServer/node_modules/telegraf/core/network/webhook.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/network/webhook.js diff --git a/TaskServer/node_modules/telegraf/core/replicators.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/replicators.js similarity index 100% rename from TaskServer/node_modules/telegraf/core/replicators.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/core/replicators.js diff --git a/TaskServer/node_modules/telegraf/extra.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/extra.js similarity index 100% rename from TaskServer/node_modules/telegraf/extra.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/extra.js diff --git a/TaskServer/node_modules/telegraf/markup.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/markup.js similarity index 100% rename from TaskServer/node_modules/telegraf/markup.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/markup.js diff --git a/TaskServer/node_modules/telegraf/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/package.json similarity index 88% rename from TaskServer/node_modules/telegraf/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/package.json index ee36d765c..1c4091521 100644 --- a/TaskServer/node_modules/telegraf/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/package.json @@ -1,33 +1,34 @@ { - "_from": "telegraf@^3.37.0", + "_from": "telegraf", "_id": "telegraf@3.38.0", "_inBundle": false, "_integrity": "sha512-va4VlrKWp64JrowFoZX/NPzzA6q38kvaIukVXOWFO1V+jR1G8+hCfgJy4TX8Z3rwLJzwaBEet1QhikHDRZWl3A==", "_location": "/telegraf", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "tag", "registry": true, - "raw": "telegraf@^3.37.0", + "raw": "telegraf", "name": "telegraf", "escapedName": "telegraf", - "rawSpec": "^3.37.0", + "rawSpec": "", "saveSpec": null, - "fetchSpec": "^3.37.0" + "fetchSpec": "latest" }, "_requiredBy": [ + "#USER", "/" ], "_resolved": "https://registry.npmjs.org/telegraf/-/telegraf-3.38.0.tgz", "_shasum": "745b447547a8e6cdb626055e4d616058aaae0759", - "_spec": "telegraf@^3.37.0", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer", + "_spec": "telegraf", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements", "author": { "name": "Vitaly Domnikov", "email": "oss@vitaly.codes" }, "bin": { - "telegraf": "./bin/telegraf" + "telegraf": "bin/telegraf" }, "bugs": { "url": "https://github.com/telegraf/telegraf/issues" diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/readme.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/readme.md new file mode 100644 index 000000000..ee9dcf222 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/readme.md @@ -0,0 +1,64 @@ +![Telegraf](docs/header.png) +[![Bot API Version](https://img.shields.io/badge/Bot%20API-v4.8-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api) +[![NPM Version](https://img.shields.io/npm/v/telegraf.svg?style=flat-square)](https://www.npmjs.com/package/telegraf) +[![node](https://img.shields.io/node/v/telegraf.svg?style=flat-square)](https://www.npmjs.com/package/telegraf) +[![Build Status](https://img.shields.io/travis/telegraf/telegraf.svg?branch=master&style=flat-square)](https://travis-ci.org/telegraf/telegraf) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) +[![Community Chat](https://img.shields.io/badge/Community-Chat-blueChat?style=flat-square&logo=telegram)](https://t.me/TelegrafJSChat) + +## Introduction + +Bots are special [Telegram](https://telegram.org) accounts designed to handle messages automatically. +Users can interact with bots by sending them command messages in private or group chats. +These accounts serve as an interface for code running somewhere on your server. + +### Features + +- Full [Telegram Bot API 4.8](https://core.telegram.org/bots/api) support +- [Telegram Payment Platform](https://telegram.org/blog/payments) +- [HTML5 Games](https://core.telegram.org/bots/api#games) +- [Inline mode](https://core.telegram.org/bots/api#inline-mode) +- Incredibly fast +- [now](https://now.sh)/[Firebase](https://firebase.google.com/products/functions/)/[Glitch](https://dashing-light.glitch.me)/[Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction)/[AWS **λ**](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html)/Whatever ready +- `http/https/fastify/Connect.js/express.js` compatible webhooks +- Easy to extend +- `TypeScript` typings + +### Installation + +``` +$ npm install telegraf +``` +or using `yarn`: +``` +$ yarn add telegraf +``` + +### Documentation + +[Telegraf developer docs](http://telegraf.js.org) + +### Examples + +```js +const { Telegraf } = require('telegraf') + +const bot = new Telegraf(process.env.BOT_TOKEN) +bot.start((ctx) => ctx.reply('Welcome!')) +bot.help((ctx) => ctx.reply('Send me a sticker')) +bot.on('sticker', (ctx) => ctx.reply('👍')) +bot.hears('hi', (ctx) => ctx.reply('Hey there')) +bot.launch() +``` + +```js +const { Telegraf } = require('telegraf') + +const bot = new Telegraf(process.env.BOT_TOKEN) +bot.command('oldschool', (ctx) => ctx.reply('Hello')) +bot.command('modern', ({ reply }) => reply('Yo')) +bot.command('hipster', Telegraf.reply('λ')) +bot.launch() +``` + +There's some cool [examples too](docs/examples/). diff --git a/TaskServer/node_modules/telegraf/router.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/router.js similarity index 100% rename from TaskServer/node_modules/telegraf/router.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/router.js diff --git a/TaskServer/node_modules/telegraf/scenes/base.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/base.js similarity index 100% rename from TaskServer/node_modules/telegraf/scenes/base.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/base.js diff --git a/TaskServer/node_modules/telegraf/scenes/context.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/context.js similarity index 100% rename from TaskServer/node_modules/telegraf/scenes/context.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/context.js diff --git a/TaskServer/node_modules/telegraf/scenes/wizard/context.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/wizard/context.js similarity index 100% rename from TaskServer/node_modules/telegraf/scenes/wizard/context.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/wizard/context.js diff --git a/TaskServer/node_modules/telegraf/scenes/wizard/index.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/wizard/index.js similarity index 100% rename from TaskServer/node_modules/telegraf/scenes/wizard/index.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/scenes/wizard/index.js diff --git a/TaskServer/node_modules/telegraf/session.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/session.js similarity index 100% rename from TaskServer/node_modules/telegraf/session.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/session.js diff --git a/TaskServer/node_modules/telegraf/stage.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/stage.js similarity index 100% rename from TaskServer/node_modules/telegraf/stage.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/stage.js diff --git a/TaskServer/node_modules/telegraf/telegraf.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/telegraf.js similarity index 100% rename from TaskServer/node_modules/telegraf/telegraf.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/telegraf.js diff --git a/TaskServer/node_modules/telegraf/telegram.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/telegram.js similarity index 100% rename from TaskServer/node_modules/telegraf/telegram.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/telegram.js diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/composer.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/composer.d.ts new file mode 100644 index 000000000..9212add6e --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/composer.d.ts @@ -0,0 +1,205 @@ +/** @format */ + +import * as tt from './telegram-types.d' +import { TelegrafContext } from './context' + +type HearsTriggers = string[] | string | RegExp | RegExp[] | ((value: string, ctx: TContext) => RegExpExecArray | null) +type BranchPredicate = boolean | ((ctx: TContext) => boolean | Promise) + +export interface MiddlewareFn { + /* + next's parameter is in a contravariant position, and thus, trying to type it + prevents assigning `MiddlewareFn` + to `MiddlewareFn`. + Middleware passing the parameter should be a separate type instead. + */ + (ctx: TContext, next: () => Promise): void | Promise +} + +export interface MiddlewareObj { + middleware(): MiddlewareFn +} + +export type Middleware = + | MiddlewareFn + | MiddlewareObj + +export declare class Composer + implements MiddlewareObj { + /** + * Registers a middleware. + */ + use(...middlewares: ReadonlyArray>): this + + /** + * Registers middleware for provided update type. + */ + on( + updateTypes: + | tt.UpdateType + | tt.UpdateType[] + | tt.MessageSubTypes + | tt.MessageSubTypes[], + ...middlewares: ReadonlyArray> + ): this + + /** + * Return the middleware created by this Composer + */ + middleware(): MiddlewareFn + + /** + * Registers middleware for handling text messages. + */ + hears( + triggers: HearsTriggers, + ...middlewares: ReadonlyArray> + ): this + + /** + * Registers middleware for handling callbackQuery data with regular expressions + */ + action( + triggers: HearsTriggers, + ...middlewares: ReadonlyArray> + ): this + + /** + * Registers middleware for handling specified commands. + */ + command( + command: string | string[], + ...middlewares: ReadonlyArray> + ): this + + /** + * Registers middleware for handling callback_data actions with game query. + */ + gameQuery(...middlewares: ReadonlyArray>): this + + /** + * Registers middleware for handling /start command. + */ + start(...middlewares: ReadonlyArray>): this + + /** + * Registers middleware for handling /help command. + */ + help(...middlewares: ReadonlyArray>): this + + constructor(...middlewares: ReadonlyArray>) + + static unwrap( + middleware: Middleware + ): MiddlewareFn + + /** + * Compose middlewares returning a fully valid middleware comprised of all those which are passed. + */ + static compose( + middlewares: ReadonlyArray> + ): MiddlewareFn + + /** + * Generates middleware for handling provided update types. + */ + static mount( + updateTypes: tt.UpdateType | tt.UpdateType[], + ...middlewares: ReadonlyArray> + ): MiddlewareFn + + /** + * Generates middleware for handling matching text messages. + */ + static hears( + triggers: HearsTriggers, + ...middlewares: ReadonlyArray> + ): MiddlewareFn + + /** + * Generates middleware for handling matching callback queries. + */ + static action( + triggers: HearsTriggers, + ...middlewares: ReadonlyArray> + ): MiddlewareFn + + /** + * Generates pass thru middleware. + */ + static passThru(): MiddlewareFn + + /** + * Generates safe version of pass thru middleware. + */ + static safePassThru(): MiddlewareFn + + /** + * Generates optional middleware. + * @param middleware middleware to run if the predicate returns true + */ + static optional( + predicate: BranchPredicate, + ...middlewares: ReadonlyArray> + ): MiddlewareFn + + /** + * Generates filter middleware. + */ + static filter( + predicate: BranchPredicate + ): MiddlewareFn + + /** + * Generates drop middleware. + */ + static drop( + predicate: BranchPredicate + ): Middleware + + /** + * @param trueMiddleware middleware to run if the predicate returns true + * @param falseMiddleware middleware to run if the predicate returns false + */ + static branch( + predicate: BranchPredicate, + trueMiddleware: Middleware, + falseMiddleware: Middleware + ): MiddlewareFn + + static reply( + text: string, + extra?: tt.ExtraReplyMessage + ): MiddlewareFn + + /** + * Generates middleware that runs in the background. + */ + static fork( + middleware: Middleware + ): MiddlewareFn + + static log(logFn?: (s: string) => void): MiddlewareFn + + /** + * Generates middleware running only in given chat types. + */ + static chatType( + type: tt.ChatType | tt.ChatType[], + ...middlewares: ReadonlyArray> + ): MiddlewareFn + + /** + * Generates middleware running only in private chats. + */ + static privateChat( + ...middlewares: ReadonlyArray> + ): MiddlewareFn + + /** + * Generates middleware running only in groups and supergroups. + */ + static groupChat( + ...middlewares: ReadonlyArray> + ): MiddlewareFn +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/context.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/context.d.ts new file mode 100644 index 000000000..7021badde --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/context.d.ts @@ -0,0 +1,524 @@ +/** @format */ + +import * as tt from './telegram-types' + +import { Telegram } from './telegram' + +export declare class TelegrafContext { + updateType: tt.UpdateType + updateSubTypes: tt.MessageSubTypes[] + update: tt.Update + tg: Telegram + botInfo?: tt.User + telegram: Telegram + callbackQuery?: tt.CallbackQuery + channelPost?: tt.Message + chat?: tt.Chat + chosenInlineResult?: tt.ChosenInlineResult + editedChannelPost?: tt.Message + editedMessage?: tt.Message + from?: tt.User + inlineQuery?: tt.InlineQuery + match?: RegExpExecArray | null + me?: string + message?: tt.IncomingMessage + poll?: tt.Poll + pollAnswer?: tt.PollAnswer + preCheckoutQuery?: tt.PreCheckoutQuery + shippingQuery?: tt.ShippingQuery + + constructor( + update: tt.Update, + telegram: Telegram, + options?: { username?: string } + ) + + /** + * Use this method to add a new sticker to a set created by the bot + * @param ownerId User identifier of sticker set owner + * @param name Sticker set name + * @param stickerData Sticker object + * @param isMasks https://github.com/telegraf/telegraf/blob/87882c42f6c2496576fdb57ca622690205c3e35e/lib/telegram.js#L304 + * @returns Returns True on success. + */ + addStickerToSet( + ownerId: number, + name: string, + stickerData: tt.StickerData, + isMasks: boolean + ): Promise + + /** + * Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set + * @param ownerId User identifier of created sticker set owner + * @param name 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. + * @param title Sticker set title, 1-64 characters + * @param stickerData Sticker object + * @returns Returns True on success. + */ + createNewStickerSet( + ownerId: number, + name: string, + title: string, + stickerData: tt.StickerData + ): Promise + + /** + * 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 admin rights. + * @returns True on success + */ + deleteChatPhoto(): Promise + + /** + * Use this method to delete a sticker from a set created by the bot. + * @param sticker File identifier of the sticker + * @returns Returns True on success + */ + deleteStickerFromSet(sticker: string): Promise + + /** + * Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. + * @returns exported invite link as String on success. + */ + exportChatInviteLink(): Promise + + /** + * 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(): Promise + + /** + * Use this method to get a list of administrators in a chat. + * @returns On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. + */ + getChatAdministrators(): Promise> + + /** + * Use this method to get information about a member of a chat. + * @param userId Unique identifier of the target user + * @returns a ChatMember object on success + */ + getChatMember(userId: number): Promise + + /** + * Use this method to get the number of members in a chat + * @returns Number on success + */ + getChatMembersCount(): Promise + + /** + * 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 admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success. + * @param user_id Unique identifier of the target user + * @param extra Additional params for restrict chat member + * @returns True on success + */ + restrictChatMember( + userId: number, + extra?: tt.ExtraRestrictChatMember + ): Promise + + /** + * Use this method to get a sticker set + * @param setName Name of the sticker set + * @returns On success, a StickerSet object is returned. + */ + getStickerSet(setName: string): Promise + + /** + * Use this method for your bot to leave a group, supergroup or channel + * @returns True on success + */ + leaveChat(): Promise + + /** + * Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights + * @param messageId Identifier of a message to pin + * @param extra Pass `{ disable_notification: true }`, if it is not necessary to send a notification to all group members about the new pinned message + * @returns True on success + */ + pinChatMessage( + messageId: number, + extra?: { disable_notification?: boolean } + ): Promise + + /** + * Use this method to unpin a message in a group, a supergroup, or a channel. + * @returns True on success + */ + unpinChatMessage(): Promise + + /** + * Use this method to reply on messages in the same chat. + * @param text Text of the message to be sent + * @param extra SendMessage additional params + * @returns sent Message if Success + */ + reply(text: string, extra?: tt.ExtraReplyMessage): Promise + + /** + * Use this method to send audio files to the same chat, if you want Telegram clients to display them in the music player. + * Your audio must be in the .mp3 format. + * Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. + * @param audio 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 + * @param extra Audio extra parameters + * @returns On success, the sent Message is returned. + */ + replyWithAudio( + audio: tt.InputFile, + extra?: tt.ExtraAudio + ): Promise + + /** + * 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). + * 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_audio or upload_audio for audio files, + * - upload_document for general files, + * - find_location for location data, + * - record_video_note or upload_video_note for video notes. + * @param action Type of action to broadcast. + * @returns True on success + */ + replyWithChatAction(action: tt.ChatAction): Promise + + /** + * Use this method to send general files. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. + * @param document 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 + * @param extra Additional params for send document + * @returns a Message on success + */ + replyWithDocument( + document: tt.InputFile, + extra?: tt.ExtraDocument + ): Promise + + /** + * Use this method to send a game + * @param gameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. + * @param extra Additional params for send game + * @returns a Message on success + */ + replyWithGame( + gameShortName: string, + extra?: tt.ExtraGame + ): Promise + + /** + * The Bot API supports basic formatting for messages + * @param html You can use bold and italic text, as well as inline links and pre-formatted code in your bots' messages. + * @param extra Additional params to send message + * @returns a Message on success + */ + replyWithHTML(html: string, extra?: tt.ExtraReplyMessage): Promise + + /** + * Use this method to send invoices + * @param invoice Object with new invoice params + * @param extra Additional params for send invoice + * @returns a Message on success + */ + replyWithInvoice( + invoice: tt.NewInvoiceParameters, + extra?: tt.ExtraInvoice + ): Promise + + /** + * Use this method to send point on the map + * @param latitude Latitude of location + * @param longitude Longitude of location + * @param extra Additional params for send location + * @returns a Message on success + */ + replyWithLocation( + latitude: number, + longitude: number, + extra?: tt.ExtraLocation + ): Promise + + /** + * The Bot API supports basic formatting for messages + * @param markdown You can use bold and italic text, as well as inline links and pre-formatted code in your bots' messages. + * @param extra Additional params to send message + * @returns a Message on success + */ + replyWithMarkdown( + markdown: string, + extra?: tt.ExtraReplyMessage + ): Promise + + /** + * Use this method to send photos + * @param photo 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 + * @param extra Additional params to send photo + * @returns a Message on success + */ + replyWithPhoto( + photo: tt.InputFile, + extra?: tt.ExtraPhoto + ): Promise + + /** + * Use this method to send a group of photos or videos as an album + * @param media A JSON-serialized array describing photos and videos to be sent, must include 2–10 items + * @param extra Additional params to send media group + * @returns On success, an array of the sent Messages is returned + */ + replyWithMediaGroup( + media: tt.MessageMedia[], + extra?: tt.ExtraMediaGroup + ): Promise> + + /** + * Use this method to send a native poll. + * @param question Poll question, 1-255 characters + * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each + * @param extra Additional params to send poll + * @returns On success, the sent Message is returned. + */ + replyWithPoll( + question: string, + options: string[], + extra: tt.ExtraPoll + ): Promise + + /** + * Use this method to send a native quiz. + * @param question Poll question, 1-255 characters + * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each + * @param extra Additional params to send quiz + * @returns On success, the sent Message is returned. + */ + replyWithQuiz( + question: string, + options: string[], + extra: tt.ExtraPoll + ): Promise + + /** + * Use this method to send a native quiz. + * @param messageId Identifier of the original message with the poll + * @param extra Additional params to stop poll + * @returns On success, the stopped Poll with the final results is returned. + */ + stopPoll(messageId: number, extra: tt.ExtraStopPoll): Promise + + /** + * Use this method to send .webp stickers + * @param sticker 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 file from the Internet, or upload a new one using multipart/form-data + * @param extra Additional params to send sticker + * @returns a Message on success + */ + replyWithSticker( + sticker: tt.InputFile, + extra?: tt.ExtraSticker + ): Promise + + /** + * Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document) + * Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. + * @param video 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 + * @param extra Additional params to send video + * @returns a Message on success + */ + replyWithVideo( + video: tt.InputFile, + extra?: tt.ExtraVideo + ): Promise + + /** + * 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. + * @param voice 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 + * @param extra Additional params to send voice + * @returns a Message on success + */ + replyWithVoice( + voice: tt.InputFile, + extra?: tt.ExtraVoice + ): Promise + + /** + * Use this method to send a dice, which will have a random value from 1 to 6. On success, the sent Message is returned. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!) + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param extra Additional params to send dice + * @returns a Message on success + */ + replyWithDice(extra?: tt.ExtraDice): Promise + + // ------------------------------------------------------------------------------------------ // + // ------------------------------------------------------------------------------------------ // + // ------------------------------------------------------------------------------------------ // + + answerCbQuery( + text?: string, + showAlert?: boolean, + extra?: object + ): Promise + + /** + * Use this method to send answers to game query. + * @param url Notification text + */ + answerGameQuery(url: string): Promise + + /** + * 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. + * @param ok Specify 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) + * @param shippingOptions Required if ok is True. A JSON-serialized array of available shipping options. + * @param errorMessage 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. + */ + answerShippingQuery( + ok: boolean, + shippingOptions: tt.ShippingOption[], + errorMessage: string + ): Promise + + /** + * 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. + * @param ok 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. + * @param errorMessage 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. + */ + answerPreCheckoutQuery(ok: boolean, errorMessage?: string): Promise + + /** + * Use this method to send answers to an inline query. + * No more than 50 results per query are allowed. + * @returns On success, True is returned. + * @param results Array of results for the inline query + * @param extra Extra optional parameters + */ + answerInlineQuery( + results: tt.InlineQueryResult[], + extra?: tt.ExtraAnswerInlineQuery + ): Promise + + /** + * Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). + * @returns On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + * @param text New text of the message + * @param extra Extra params + */ + editMessageText( + text: string, + extra?: tt.ExtraEditMessage + ): Promise + + /** + * Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). + * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + * @param caption New caption of the message + * @param markup Markup of inline keyboard + */ + editMessageCaption( + caption?: string, + markup?: tt.InlineKeyboardMarkup + ): Promise + + /** + * Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). + * @returns On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + * @param markup Markup of inline keyboard + */ + editMessageReplyMarkup( + markup?: tt.InlineKeyboardMarkup + ): Promise + + /** + * Use this method to edit animation, audio, document, photo, or video messages. + * @returns On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. + * @param media New media of message + * @param markup Markup of inline keyboard + */ + editMessageMedia( + media: tt.MessageMedia, + extra?: tt.ExtraEditMessage + ): Promise + + /** + * Use this method to edit live location messages. + * @returns On success, if the edited message was sent by the bot, the edited message is returned, otherwise True is returned. + * @param lat New latitude + * @param lon New longitude + */ + editMessageLiveLocation( + lat: number, + lon: number, + extra?: tt.ExtraLocation + ): Promise + + /** + * Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group 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 admin rights + * @param userId Unique identifier of the target user + * @param untilDate 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 + * @returns True on success + */ + kickChatMember(userId: number, untilDate?: number): Promise + + /** + * Use this method to unban a user from a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights + * @param userId Unique identifier of the target user + * @returns True on success + */ + unbanChatMember(userId: number): Promise + + /** + * 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 admin rights. Pass False for all boolean parameters to demote a user. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) + * @param userId Unique identifier of the target user + * @returns True on success + */ + promoteChatMember( + userId: number, + extra: tt.ExtraPromoteChatMember + ): Promise + + /** + * Use this method to stop updating a live location message before live_period expires. + * @returns On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned. + * @param extra Extra params + */ + stopMessageLiveLocation( + extra?: tt.ExtraLocation + ): Promise + + /** + * 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. + * - Bots can delete outgoing messages in groups and supergroups. + * - 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 Returns True on success. + */ + deleteMessage(messageId?: number): Promise + + /** + * Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times) + * https://core.telegram.org/bots/api#sending-files + * @param ownerId User identifier of sticker file owner + * @param stickerFile Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. + * @returns Returns the uploaded File on success + */ + uploadStickerFile( + ownerId: number, + stickerFile: tt.InputFile + ): Promise + + /** + * Use this method to move a sticker in a set created by the bot to a specific position + * @param sticker File identifier of the sticker + * @param position New sticker position in the set, zero-based + * @returns Returns True on success. + */ + setStickerPositionInSet(sticker: string, position: number): Promise + + /** + * 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 admin rights + * @param title New chat title, 1-255 characters + * @returns True on success + */ + setChatTitle(title: string): Promise +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/extra.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/extra.d.ts new file mode 100644 index 000000000..f05a0161b --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/extra.d.ts @@ -0,0 +1,39 @@ +/** @format */ + +import * as tt from './telegram-types.d' + +export declare class Extra { + constructor(opts: object) + + load(opts: object): this + + inReplyTo(messageId: string | number): this + + notifications(value?: boolean): this + + webPreview(value?: boolean): this + + markup(markup: any): tt.ExtraEditMessage & this + + HTML(value?: boolean): this + + markdown(value?: boolean): this + + caption(caption: string): this + + static load(opts: object): Extra + + static inReplyTo(messageId: string | number): Extra + + static notifications(value?: boolean): Extra + + static webPreview(value?: boolean): Extra + + static markup(markup: any): tt.ExtraEditMessage + + static HTML(value?: boolean): Extra + + static markdown(value?: boolean): Extra + + static caption(caption: string): Extra +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/index.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/index.d.ts new file mode 100644 index 000000000..a5cb3a48e --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/index.d.ts @@ -0,0 +1,11 @@ +/** @format */ + +export { BaseScene, Stage } from './stage' +export { Composer, Middleware } from './composer' +export { Extra } from './extra' +export { Markup } from './markup' +export { Router } from './router' +export { session } from './session' +export { Telegraf, Telegraf as default } from './telegraf' +export { TelegrafContext as Context } from './context' +export { Telegram } from './telegram' diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/markup.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/markup.d.ts new file mode 100644 index 000000000..b38508a4c --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/markup.d.ts @@ -0,0 +1,225 @@ +/** @format */ + +import * as tt from './telegram-types.d' + +export interface Button { + text: string + hide: boolean +} + +export interface ContactRequestButton { + text: string + hide: boolean + request_contact: boolean +} + +export interface LocationRequestButton { + text: string + hide: boolean + request_location: boolean +} + +type PollType = 'poll' | 'quiz' + +export interface PollRequestButton { + text: string + request_poll: { type?: PollType } +} + +export type KeyboardButton = + | Button + | ContactRequestButton + | LocationRequestButton + | PollRequestButton + | string + +export interface UrlButton { + url: string + text: string + hide?: boolean +} + +export interface CallbackButton { + text: string + hide: boolean + callback_data: string +} + +export interface SwitchToChatButton { + text: string + hide: boolean + switch_inline_query: string +} + +export interface SwitchToCurrentChatButton { + text: string + hide: boolean + switch_inline_query_current_chat: string +} + +export interface GameButton { + text: string + hide: boolean + callback_game: tt.CallbackGame +} + +export interface PayButton { + pay: boolean + text: string + hide: boolean +} + +export interface LoginUrl { + url: string + forward_text?: string + bot_username?: string + request_write_access?: boolean +} + +export interface LoginButton { + text: string + login_url: LoginUrl + hide: boolean +} + +export type InlineKeyboardButton = + | UrlButton + | CallbackButton + | SwitchToChatButton + | SwitchToCurrentChatButton + | GameButton + | PayButton + | LoginButton + +export interface KeyboardOptions { + columns?: number + wrap?(btn: TBtn, index: number, currentRow: TBtn[]): boolean +} + +export declare class Markup { + forceReply(value?: boolean): this + + removeKeyboard(value?: boolean): this + + selective(value?: boolean): this + + extra(options?: tt.ExtraReplyMessage): tt.ExtraReplyMessage + + keyboard( + buttons: KeyboardButton[] | KeyboardButton[][], + options?: KeyboardOptions + ): this & tt.ReplyKeyboardMarkup + + resize(value?: boolean): this + + oneTime(value?: boolean): this + + inlineKeyboard( + buttons: InlineKeyboardButton[] | InlineKeyboardButton[][], + options: KeyboardOptions + ): this & tt.InlineKeyboardMarkup + + button(text: string, hide?: boolean): Button + + contactRequestButton(text: string, hide?: boolean): ContactRequestButton + + locationRequestButton(text: string, hide?: boolean): LocationRequestButton + + urlButton(text: string, url: string, hide?: boolean): UrlButton + + callbackButton(text: string, data: string, hide?: boolean): CallbackButton + + switchToChatButton( + text: string, + value: string, + hide?: boolean + ): SwitchToChatButton + + switchToCurrentChatButton( + text: string, + value: string, + hide?: boolean + ): SwitchToCurrentChatButton + + gameButton(text: string, hide?: boolean): GameButton + + payButton(text: string, hide?: boolean): PayButton + + loginButton( + text: string, + url: string, + opts: Omit, + hide?: boolean + ): LoginButton + + static removeKeyboard(value?: string): Markup + + static forceReply(value?: string): Markup + + static keyboard( + buttons: KeyboardButton[] | KeyboardButton[][], + options?: KeyboardOptions + ): Markup & tt.ReplyKeyboardMarkup + + static inlineKeyboard( + buttons: InlineKeyboardButton[] | InlineKeyboardButton[][], + options?: KeyboardOptions + ): Markup & tt.InlineKeyboardMarkup + + static resize(value?: boolean): Markup + + static selective(value?: boolean): Markup + + static oneTime(value?: boolean): Markup + + static button(text: string, hide?: boolean): Button + + static contactRequestButton( + text: string, + hide?: boolean + ): ContactRequestButton + + static locationRequestButton( + text: string, + hide?: boolean + ): LocationRequestButton + + static pollRequestButton( + text: string, + type: PollType, + hide?: boolean + ): PollRequestButton + + static urlButton(text: string, url: string, hide?: boolean): UrlButton + + static callbackButton( + text: string, + data: string, + hide?: boolean + ): CallbackButton + + static switchToChatButton( + text: string, + value: string, + hide?: boolean + ): SwitchToChatButton + + static switchToCurrentChatButton( + text: string, + value: string, + hide?: boolean + ): SwitchToCurrentChatButton + + static gameButton(text: string, hide?: boolean): GameButton + + static payButton(text: string, hide?: boolean): PayButton + + static loginButton( + text: string, + url: string, + opts: Omit, + hide?: boolean + ): LoginButton + + static formatHTML(text: string, entities: Array): string +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/router.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/router.d.ts new file mode 100644 index 000000000..3eb69ecc7 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/router.d.ts @@ -0,0 +1,37 @@ +/** @format */ + +import { MiddlewareObj, Middleware, MiddlewareFn } from './composer' +import { TelegrafContext } from './context' + +type TRoute = string +type MaybePromise = T | Promise + +export type RouteFn = ( + ctx: TContext +) => MaybePromise<{ + route?: TRoute +} | null> + +type HandlersMap = Map< + TRoute, + Middleware +> + +declare class Router + implements MiddlewareObj { + routeFn: RouteFn + handlers: HandlersMap + otherwiseHandler: Middleware + + constructor(routeFn: RouteFn, handlers?: HandlersMap) + + on( + route: TRoute, + fn: Middleware, + ...fns: Middleware[] + ): this + + otherwise(fn: Middleware, ...fns: Middleware[]): this + + middleware(): MiddlewareFn +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/session.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/session.d.ts new file mode 100644 index 000000000..21d0f7afa --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/session.d.ts @@ -0,0 +1,11 @@ +/** @format */ + +import { TelegrafContext } from './context' +import { Middleware } from './composer' + +export declare function session(opts?: { + property?: string + store?: Map + getSessionKey?: (ctx: TContext) => string + ttl?: number +}): Middleware diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/stage.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/stage.d.ts new file mode 100644 index 000000000..ad6e591fb --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/stage.d.ts @@ -0,0 +1,100 @@ +/** @format */ + +import { TelegrafContext } from './context' +import { Middleware, Composer, MiddlewareFn } from './composer' + +export interface SceneContextOptions { + sessionName: string + default?: string + ttl?: number +} + +export interface SceneContext { + ctx: TContext + + scenes: Map> + + options: SceneContextOptions + + readonly session: { + state?: object + current?: string + expires?: number + } + + state: object + + readonly current: BaseScene | null + + reset: () => void + + enter: ( + sceneId: string, + initialState?: object, + silent?: boolean + ) => Promise + + reenter: () => Promise + + leave: () => Promise +} + +export interface SceneContextMessageUpdate extends TelegrafContext { + scene: SceneContext +} +export interface BaseSceneOptions { + handlers: Middleware[] + enterHandlers: Middleware[] + leaveHandlers: Middleware[] + ttl?: number +} + +export class BaseScene< + TContext extends SceneContextMessageUpdate +> extends Composer { + constructor(id: string, options?: Partial>) + + id: string + + options: BaseSceneOptions + + enterHandler: Middleware + + leaveHandler: Middleware + + ttl?: number + + enter: (...fns: Middleware[]) => this + + leave: (...fns: Middleware[]) => this + + enterMiddleware: () => Middleware + + leaveMiddleware: () => Middleware +} + +export type Scene = BaseScene< + TContext +> + +export type StageOptions = SceneContextOptions + +export class Stage extends Composer< + TContext +> { + constructor(scenes: Scene[], options?: Partial) + + register: (...scenes: Scene[]) => this + + middleware: () => MiddlewareFn + + static enter: ( + sceneId: string, + initialState?: object, + silent?: boolean + ) => Middleware + + static reenter: () => Middleware + + static leave: () => Middleware +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegraf.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegraf.d.ts new file mode 100644 index 000000000..09e4921da --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegraf.d.ts @@ -0,0 +1,217 @@ +/** @format */ + +/// + +import { IncomingMessage, ServerResponse } from 'http' +import * as https from 'https' +import * as http from 'http' +import { TlsOptions } from 'tls' + +import * as tt from './telegram-types.d' + +import { TelegrafContext } from './context' +import { Composer } from './composer' +import { Telegram, TelegramOptions } from './telegram' + +export interface TelegrafOptions { + /** + * Telegram options + */ + telegram?: TelegramOptions + + /** + * Bot username + */ + username?: string +} + +export interface LaunchPollingOptions { + /** + * Poll timeout in seconds + */ + timeout?: number + + /** + * Limits the number of updates to be retrieved + */ + limit?: number + + /** + * List the types of updates you want your bot to receive + */ + allowedUpdates?: tt.UpdateType[] | tt.UpdateType | null + + /** + * Polling stop callback + */ + stopCallback?: () => void | null +} + +export interface LaunchWebhookOptions { + /** + * Public domain for webhook. If domain is not specified, hookPath should contain a domain name as well (not only path component). + */ + domain?: string + + /** + * Webhook url path; will be automatically generated if not specified + */ + hookPath?: string + + /** + * The port to listen on for Telegram calls. If port is omitted or is 0, the operating system will assign an arbitrary unused port. + */ + port?: number + + /** + * The host to listen on for Telegram calls. If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise. + */ + host?: string + + /** + * TLS server options. Pass null (or omit) to use http. + */ + tlsOptions?: TlsOptions | null + + /** + * A callback function suitable for the http[s].createServer() method to handle a request. + */ + cb?: (req: IncomingMessage, res: ServerResponse) => void +} + +export declare class Telegraf< + TContext extends TelegrafContext +> extends Composer { + /** + * Use this property to get/set bot token + */ + token: string + + /** + * Use this property to control reply via webhook feature. + */ + webhookReply: boolean + + /** + * Use this property to get telegram instance + */ + telegram: Telegram + + /** + * Use this property to extend context and support your custom interface + */ + context: TContext + + /** + * Telegraf options + */ + options: TOptions + + /** + * Initialize new Telegraf app. + * @param token Bot token + * @param options options + * @example + * new Telegraf(token, options) + */ + constructor(token: string, options?: TelegrafOptions) + + /** + * Launch bot in long-polling or webhook mode. + * + * @param options [See reference to get more]{@link https://telegraf.js.org/#/?id=launch} + */ + launch(options?: { + polling?: LaunchPollingOptions + webhook?: LaunchWebhookOptions + }): Promise + + /** + * Start poll updates. + * @param timeout Poll timeout in seconds + * @param limit Limits the number of updates to be retrieved + * @param allowedUpdates List the types of updates you want your bot to receive + * @param stopCallback Polling stop callback + */ + startPolling( + timeout?: number, + limit?: number, + allowedUpdates?: tt.UpdateType[] | tt.UpdateType | null, + stopCallback?: () => void | null + ): Telegraf + + /** + * Start listening @ https://host:port/hookPath for Telegram calls. + * @param hookPath Webhook url path (see Telegraf.setWebhook) + * @param tlsOptions TLS server options. Pass null to use http + * @param port Port number + * @param host Hostname + * @param cb A callback function suitable for the http[s].createServer() method to handle a request. + */ + startWebhook( + hookPath: string, + tlsOptions?: TlsOptions | null, + port?: number, + host?: string, + cb?: (req: IncomingMessage, res: ServerResponse) => void + ): Telegraf + + /** + * Stop Webhook and polling + */ + stop(cb?: () => void): Promise + + /** + * Return a callback function suitable for the http[s].createServer() method to handle a request. + * You may also use this callback function to mount your telegraf app in a Koa/Connect/Express app. + * @param hookPath Webhook url path (see Telegraf.setWebhook) + */ + webhookCallback( + hookPath: string + ): (req: IncomingMessage, res: ServerResponse) => void + + handleUpdates(updates: tt.Update[]): Promise + + /** + * Handle raw Telegram update. In case you use centralized webhook server, queue, etc. + */ + handleUpdate( + update: tt.Update, + webhookResponse?: ServerResponse + ): Promise + + private fetchUpdates(): void + + catch(logFn?: Function): void +} + +export interface TOptions { + /** + * Telegram options + */ + telegram?: { + /** + * https.Agent or http.Agent instance, allows custom proxy, certificate, keep alive, etc. + */ + agent: https.Agent | http.Agent + + /** + * Reply via webhook + */ + webhookReply: boolean + } + + /** + * Bot username + */ + username?: string + + /** + * Handle `channel_post` updates as messages + */ + channelMode?: boolean + + retryAfter?: number + + handlerTimeout?: number +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegram-types.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegram-types.d.ts new file mode 100644 index 000000000..decfa226b --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegram-types.d.ts @@ -0,0 +1,803 @@ +import * as TT from "telegram-typings"; +export * from "telegram-typings"; + +export type ParseMode = 'Markdown' | 'MarkdownV2' | 'HTML' + +export type ChatAction = + 'typing' | + 'upload_photo' | + 'record_video' | + 'upload_video' | + 'record_audio' | + 'upload_audio' | + 'upload_document' | + 'find_location' | + 'record_video_note' | + 'upload_video_note' + +export type ChatType = + 'private' | + 'group' | + 'supergroup' | + 'channel' + +export type UpdateType = + 'callback_query' | + 'channel_post' | + 'chosen_inline_result' | + 'edited_channel_post' | + 'edited_message' | + 'inline_query' | + 'message' | + 'pre_checkout_query' | + 'shipping_query' | + 'poll' | + 'poll_answer' + +export type MessageSubTypes = + 'voice' | + 'video_note' | + 'video' | + 'venue' | + 'text' | + 'supergroup_chat_created' | + 'successful_payment' | + 'sticker' | + 'pinned_message' | + 'photo' | + 'new_chat_title' | + 'new_chat_photo' | + 'new_chat_members' | + 'migrate_to_chat_id' | + 'migrate_from_chat_id' | + 'location' | + 'left_chat_member' | + 'invoice' | + 'group_chat_created' | + 'game' | + 'document' | + 'delete_chat_photo' | + 'contact' | + 'channel_chat_created' | + 'audio' | + 'passport_data' | + 'connected_website' | + 'animation' + +export type InlineQueryResult = + TT.InlineQueryResultCachedAudio | + TT.InlineQueryResultCachedDocument | + TT.InlineQueryResultCachedGif | + TT.InlineQueryResultCachedMpeg4Gif | + TT.InlineQueryResultCachedPhoto | + TT.InlineQueryResultCachedSticker | + TT.InlineQueryResultCachedVideo | + TT.InlineQueryResultCachedVoice | + TT.InlineQueryResultArticle | + TT.InlineQueryResultAudio | + TT.InlineQueryResultContact | + TT.InlineQueryResultGame | + TT.InlineQueryResultDocument | + TT.InlineQueryResultGif | + TT.InlineQueryResultLocation | + TT.InlineQueryResultMpeg4Gif | + TT.InlineQueryResultPhoto | + TT.InlineQueryResultVenue | + TT.InlineQueryResultVideo | + TT.InlineQueryResultVoice + +export type MessageMedia = + InputMediaPhoto | + InputMediaVideo | + InputMediaAnimation | + InputMediaAudio | + InputMediaDocument + +export interface InputMediaPhoto { + type: string + media: InputFile + caption?: string + parse_mode?: string +} + +export interface InputMediaVideo { + type: string + media: InputFile + thumb?: string | InputFile + caption?: string + parse_mode?: string + width?: number + height?: number + duration?: number + supports_streaming?: boolean +} + +export interface InputMediaAnimation { + type: string + media: InputFile + thumb?: string | InputFile + caption?: string + parse_mode?: string + width?: number + height?: number + duration?: number + supports_streaming?: boolean +} + +export interface InputMediaAudio { + type: string + media: InputFile + thumb?: string | InputFile + caption?: string + parse_mode?: string + performer?: string + title?: string + duration?: number + supports_streaming?: boolean +} + +export interface InputMediaDocument { + type: string + media: InputFile + thumb?: string | InputFile + caption?: string + parse_mode?: string +} + +export interface StickerData { + png_sticker: string | Buffer + emojis: string + mask_position: TT.MaskPosition +} + +type FileId = string + +export interface InputFileByPath { + source: string +} + +export interface InputFileByReadableStream { + source: NodeJS.ReadableStream +} + +export interface InputFileByBuffer { + source: Buffer +} + +export interface InputFileByURL { + url: string + filename: string +} + +export type InputFile = + FileId | + InputFileByPath | + InputFileByReadableStream | + InputFileByBuffer | + InputFileByURL + +/** + * Sending video notes by a URL is currently unsupported + */ +export type InputFileVideoNote = Exclude + +export interface ChatPermissions { + /** True, if the user is allowed to send text messages, contacts, locations and venues */ + can_send_messages?: boolean + + /** True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages */ + can_send_media_messages?: boolean + + /** True, if the user is allowed to send polls, implies can_send_messages */ + can_send_polls?: boolean + + /** True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages */ + can_send_other_messages?: boolean + + /** True, if the user is allowed to add web page previews to their messages, implies can_send_media_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 +} + +export interface ExtraRestrictChatMember { + /** New user permissions */ + permissions: ChatPermissions + + /** 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 +} + +export interface ExtraPromoteChatMember { + /** Pass True, if the administrator can change chat title, photo and other settings */ + can_change_info?: 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 invite new users to the chat */ + can_invite_users?: boolean + + /** Pass True, if the administrator can restrict, ban or unban chat members */ + can_restrict_members?: boolean + + /** Pass True, if the administrator can pin messages, supergroups only */ + can_pin_messages?: boolean + + /** Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) */ + can_promote_members?: boolean +} + +export interface ExtraReplyMessage { + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. + */ + parse_mode?: ParseMode + + /** + * Disables link previews for links in this message + */ + disable_web_page_preview?: boolean + + /** + * Sends the message silently. Users will receive a notification with no sound. + */ + disable_notification?: boolean + + /** + * If the message is a reply, ID of the original message + */ + reply_to_message_id?: number + + /** + * 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?: TT.InlineKeyboardMarkup | TT.ReplyKeyboardMarkup | TT.ReplyKeyboardRemove | TT.ForceReply +} + +export interface ExtraEditMessage extends ExtraReplyMessage { + // no specified properties +} + +export interface ExtraAudio extends ExtraReplyMessage { + /** + * Audio caption, 0-1024 characters + */ + caption?: string + + /** + * 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 . + */ + thumb?: InputFile + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendaudio + */ + disable_web_page_preview?: never +} + +export interface ExtraDocument extends ExtraReplyMessage { + /** + * 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 . + */ + thumb?: InputFile + + /** + * Document caption (may also be used when resending documents by file_id), 0-1024 characters + */ + caption?: string + + /** + * Does not exist, see https://core.telegram.org/bots/api#senddocument + */ + disable_web_page_preview?: never +} + +export interface ExtraGame extends ExtraReplyMessage { + /** + * Inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game. + */ + reply_markup?: TT.InlineKeyboardMarkup + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendgame + */ + disable_web_page_preview?: never + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendgame + */ + parse_mode?: never +} + +export interface ExtraInvoice extends ExtraReplyMessage { + /** + * 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?: TT.InlineKeyboardMarkup + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendinvoice + */ + disable_web_page_preview?: never + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendinvoice + */ + parse_mode?: never +} + +export interface ExtraLocation extends ExtraReplyMessage { + /** + * Period in seconds for which the location will be updated (should be between 60 and 86400) + */ + live_period?: number + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendlocation + */ + disable_web_page_preview?: never + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendlocation + */ + parse_mode?: never +} + +export interface ExtraPhoto extends ExtraReplyMessage { + /** + * Photo caption (may also be used when resending photos by file_id), 0-1024 characters + */ + caption?: string + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendphoto + */ + disable_web_page_preview?: never +} + +export interface ExtraMediaGroup extends ExtraReplyMessage { + /** + * Does not exist, see https://core.telegram.org/bots/api#sendmediagroup + */ + disable_web_page_preview?: never + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendmediagroup + */ + parse_mode?: never + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendmediagroup + */ + reply_markup?: never +} + +export interface ExtraAnimation extends ExtraReplyMessage { + /** + * Animation caption (may also be used when resending animation by file_id), 0-200 characters + */ + caption?: string +} + +export interface ExtraSticker extends ExtraReplyMessage { + /** + * Does not exist, see https://core.telegram.org/bots/api#sendsticker + */ + disable_web_page_preview?: never + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendsticker + */ + parse_mode?: never +} + +export interface ExtraVideo extends ExtraReplyMessage { + /** + * 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 . + */ + thumb?: InputFile + + /** + * Video caption (may also be used when resending videos by file_id), 0-1024 characters + */ + caption?: string + + /** + * Pass True, if the uploaded video is suitable for streaming + */ + supports_streaming?: boolean + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendvideo + */ + disable_web_page_preview?: never +} + +export interface ExtraVideoNote extends ExtraReplyMessage { + /** + * 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 . + */ + thumb?: InputFile +} + +export interface ExtraVoice extends ExtraReplyMessage { + /** + * Voice message caption, 0-1024 characters + */ + caption?: string + + /** + * Duration of the voice message in seconds + */ + duration?: number + + /** + * Does not exist, see https://core.telegram.org/bots/api#sendvoice + */ + disable_web_page_preview?: never +} + +export interface ExtraDice extends ExtraReplyMessage { + /** + * Does not exist, see https://core.telegram.org/bots/api#senddice + */ + parse_mode?: never + + /** + * Does not exist, see https://core.telegram.org/bots/api#senddice + */ + disable_web_page_preview?: never +} + +export interface ExtraPoll { + /** True, if the poll needs to be anonymous, defaults to True */ + is_anonymous?: boolean + + /** 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 + + /** 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 + + /** If the message is a reply, ID of the original message */ + reply_to_message_id?: number + + /** Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */ + reply_markup?: + | TT.InlineKeyboardMarkup + | TT.ReplyKeyboardMarkup + | TT.ReplyKeyboardRemove + | TT.ForceReply +} + +export interface ExtraStopPoll { + /** A JSON-serialized object for a new message inline keyboard. */ + reply_markup?: TT.InlineKeyboardMarkup +} + +export interface IncomingMessage extends TT.Message { + audio?: TT.Audio + entities?: TT.MessageEntity[] + caption?: string + document?: TT.Document + game?: TT.Game + photo?: TT.PhotoSize[] + animation?: TT.Animation + sticker?: TT.Sticker + video?: TT.Video + video_note?: TT.VideoNote + contact?: TT.Contact + location?: TT.Location + venue?: TT.Venue + pinned_message?: TT.Message + invoice?: TT.Invoice + successful_payment?: TT.SuccessfulPayment + dice?: Dice +} + +export interface MessageAudio extends TT.Message { + audio: TT.Audio +} + +export interface MessageDocument extends TT.Message { + document: TT.Document +} + +export interface MessageGame extends TT.Message { + game: TT.Game +} + +export interface MessageInvoice extends TT.Message { + invoice: TT.Invoice +} + +export interface MessageLocation extends TT.Message { + location: TT.Location +} + +export interface MessagePhoto extends TT.Message { + photo: TT.PhotoSize[] +} + +export interface MessageAnimation extends TT.Message { + animation: TT.Animation +} + +export interface MessageSticker extends TT.Message { + sticker: TT.Sticker +} + +export interface MessageVideo extends TT.Message { + video: TT.Video +} + +export interface MessageVideoNote extends TT.Message { + video_note: TT.VideoNote +} + +export interface MessageVoice extends TT.Message { + voice: TT.Voice +} + +export interface MessageDice extends TT.Message { + dice: Dice +} + +export interface MessagePoll extends TT.Message { + poll: Poll +} + +export interface NewInvoiceParameters { + /** + * 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 + + /** + * Payments provider token, obtained via Botfather + */ + provider_token: string + + /** + * Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter + */ + start_parameter: 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: TT.LabeledPrice[] + + /** + * 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 + */ + 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?: true + + /** + * Pass True, if you require the user's phone number to complete the order + */ + need_phone_number?: true + + /** + * Pass True, if you require the user's email to complete the order + */ + need_email?: true + + /** + * Pass True, if you require the user's shipping address to complete the order + */ + need_shipping_address?: true + + /** + * Pass True, if the final price depends on the shipping method + */ + is_flexible?: true +} + +export interface ExtraAnswerInlineQuery { + /** + * 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 + + /** + * If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter + */ + switch_pm_text?: string + + /** + * Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. + */ + switch_pm_parameter?: 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, 3-256 characters. + */ + description: string +} + +/** + * This object represents a dice with random value from 1 to 6. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!) + */ +export interface Dice { + /** + * Value of the dice, 1-6 + */ + value: number +} + +export interface PollOption { + /** Option text, 1-100 characters */ + text: string + + /** Number of users that voted for this option */ + voter_count: number +} + +export interface PollAnswer { + /** Unique poll identifier */ + poll_id: string + + /** The user, who changed the answer to the poll */ + user: TT.User + + /** 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. */ + option_ids: number[] +} + +export interface Poll { + /** Unique poll identifier */ + id: string + + /** Poll question, 1-255 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 +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegram.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegram.d.ts new file mode 100644 index 000000000..4d7a20699 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegraf/typings/telegram.d.ts @@ -0,0 +1,686 @@ +/** @format */ + +import * as tt from './telegram-types.d' + +import * as https from 'https' +import * as http from 'http' + +export interface TelegramOptions { + /** + * https.Agent or http.Agent instance, allows custom proxy, certificate, keep alive, etc. + */ + agent?: https.Agent | http.Agent + + /** + * Reply via webhook + */ + webhookReply?: boolean + + /** + * Path to API. default: https://api.telegram.org + */ + apiRoot?: string +} + +declare class ApiClient { + protected constructor(token: string, options: object, webhookResponse: any) + + callApi(method: string, data: object): Promise +} + +export declare class Telegram extends ApiClient { + /** + * Initialize new Telegram app. + * @param token Bot token + * @param options Telegram options + */ + constructor(token: string, options?: TelegramOptions) + + /** + * Use this property to control reply via webhook feature. + */ + webhookReply: boolean + + /** + * Use this method to send answers to game query. + * @param callbackQueryId Query id + * @param url Notification text + */ + answerGameQuery(callbackQueryId: string, url: string): Promise + + /** + * 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. + * @param shippingQueryId Unique identifier for the query to be answered + * @param ok Specify 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) + * @param shippingOptions Required if ok is True. A JSON-serialized array of available shipping options. + * @param errorMessage 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. + */ + answerShippingQuery( + shippingQueryId: string, + ok: boolean, + shippingOptions: Array, + errorMessage: string + ): Promise + + /** + * 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. + * @param preCheckoutQueryId Unique identifier for the query to be answered + * @param ok 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. + * @param errorMessage 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. + */ + answerPreCheckoutQuery( + preCheckoutQueryId: string, + ok: boolean, + errorMessage?: string + ): Promise + + /** + * Use this method to send answers to an inline query. On success, True is returned. + * No more than 50 results per query are allowed. + * @param inlineQueryId Unique identifier for the answered query + * @param results Array of results for the inline query + * @param extra Extra optional parameters + */ + answerInlineQuery( + inlineQueryId: string, + results: Array, + extra?: tt.ExtraAnswerInlineQuery + ): Promise + + /** + * Use this method to forward exists message. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername) + * @param messageId Message identifier in the chat specified in from_chat_id + * @param extra Pass `{ disable_notification: true }`, if it is not necessary to send a notification for forwarded message + * @returns On success, the sent Message is returned. + */ + forwardMessage( + chatId: number | string, + fromChatId: number | string, + messageId: string | number, + extra?: { disable_notification?: boolean } + ): Promise + + /** + * Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). + * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message + * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message + * @param text New text of the message + * @param extra Extra params + */ + editMessageText( + chatId: number | string | void, + messageId: number | void, + inlineMessageId: string | void, + text: string, + extra?: tt.ExtraEditMessage + ): Promise + + /** + * Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). + * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message + * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message + * @param caption New caption of the message + * @param markup A JSON-serialized object for an inline keyboard. + */ + editMessageCaption( + chatId?: number | string, + messageId?: number, + inlineMessageId?: string, + caption?: string, + markup?: string + ): Promise + + /** + * Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). + * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. + * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message + * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message + * @param markup A JSON-serialized object for an inline keyboard. + */ + editMessageReplyMarkup( + chatId?: number | string, + messageId?: number, + inlineMessageId?: string, + markup?: string + ): Promise + + /** + * 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. + * - Bots can delete outgoing messages in groups and supergroups. + * - 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. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Identifier of the message to delete + * @returns Returns True on success. + */ + deleteMessage(chatId: number | string, messageId: number): Promise + + /** + * Use this method to get a sticker set + * @param setName Name of the sticker set + * @returns On success, a StickerSet object is returned. + */ + getStickerSet(setName: string): Promise + + /** + * Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times) + * https://core.telegram.org/bots/api#sending-files + * @param ownerId User identifier of sticker file owner + * @param stickerFile Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. + * @returns Returns the uploaded File on success + */ + uploadStickerFile( + ownerId: number, + stickerFile: tt.InputFile + ): Promise + + /** + * Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set + * @param ownerId User identifier of created sticker set owner + * @param name 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. + * @param title Sticker set title, 1-64 characters + * @param stickerData Sticker object + * @returns Returns True on success. + */ + createNewStickerSet( + ownerId: number, + name: string, + title: string, + stickerData: tt.StickerData + ): Promise + + /** + * Use this method to add a new sticker to a set created by the bot + * @param ownerId User identifier of sticker set owner + * @param name Sticker set name + * @param stickerData Sticker object + * @param isMasks https://github.com/telegraf/telegraf/blob/87882c42f6c2496576fdb57ca622690205c3e35e/lib/telegram.js#L304 + * @returns Returns True on success. + */ + addStickerToSet( + ownerId: number, + name: string, + stickerData: tt.StickerData, + isMasks: boolean + ): Promise + + /** + * Use this method to move a sticker in a set created by the bot to a specific position + * @param sticker File identifier of the sticker + * @param position New sticker position in the set, zero-based + * @returns Returns True on success. + */ + setStickerPositionInSet(sticker: string, position: number): Promise + + /** + * Use this method to delete a sticker from a set created by the bot. + * @param sticker File identifier of the sticker + * @returns Returns True on success + */ + deleteStickerFromSet(sticker: string): Promise + + /** + * Use this method to send copy of exists message. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param message Received message object + * @param extra Specified params for message + * @returns On success, the sent Message is returned. + */ + sendCopy( + chatId: number | string, + message?: tt.Message, + extra?: object + ): Promise + + /** + * 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 admin rights. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @returns True on success + */ + deleteChatPhoto(chatId: number | string): Promise + + /** + * Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @returns exported invite link as String on success. + */ + exportChatInviteLink(chatId: number | string): Promise + + /** + * Use this method to get basic information about the bot + * @returns a User object on success. + */ + getMe(): Promise + + /** + * 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.) + * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) + * @returns a Chat object on success. + */ + getChat(chatId: number | string): Promise + + /** + * Use this method to get a list of administrators in a chat. + * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) + * @returns On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. + */ + getChatAdministrators(chatId: number | string): Promise> + + /** + * Use this method to get information about a member of a chat. + * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) + * @param userId Unique identifier of the target user + * @returns a ChatMember object on success + */ + getChatMember(chatId: string | number, userId: number): Promise + + /** + * Use this method to get the number of members in a chat + * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) + * @returns Number on success + */ + getChatMembersCount(chatId: string | number): Promise + + /** + * 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 admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success. + * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * @param user_id Unique identifier of the target user + * @param extra Additional params for restrict chat member + * @returns True on success + */ + restrictChatMember( + chatId: string | number, + userId: number, + extra?: tt.ExtraRestrictChatMember + ): Promise + + /** + * Use this method for your bot to leave a group, supergroup or channel + * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) + * @returns True on success + */ + leaveChat(chatId: number | string): Promise + + /** + * Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights + * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * @param messageId Identifier of a message to pin + * @param extra Pass `{ disable_notification: true }`, if it is not necessary to send a notification to all group members about the new pinned message + * @returns True on success + */ + pinChatMessage( + chatId: number | string, + messageId: number, + extra?: { disable_notification?: boolean } + ): Promise + + /** + * Use this method to unpin a message in a group, a supergroup, or a channel. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @returns True on success + */ + unpinChatMessage(chatId: number | string): Promise + + /** + * Use this method to send text messages + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param text Text of the message to be sent + * @param extra SendMessage additional params + * @returns sent Message if Success + */ + sendMessage( + chatId: number | string, + text: string, + extra?: tt.ExtraEditMessage + ): Promise + + /** + * 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 format. + * Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param audio 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 + * @param extra Audio extra parameters + * @returns On success, the sent Message is returned. + */ + sendAudio( + chatId: number | string, + audio: tt.InputFile, + extra?: tt.ExtraAudio + ): Promise + + /** + * 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). + * 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_audio or upload_audio for audio files, + * - upload_document for general files, + * - find_location for location data, + * - record_video_note or upload_video_note for video notes. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param action Type of action to broadcast. + * @returns True on success + */ + sendChatAction( + chatId: number | string, + action: tt.ChatAction + ): Promise + + /** + * Use this method to send general files. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param document 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 + * @param extra Additional params for send document + * @returns a Message on success + */ + sendDocument( + chatId: number | string, + document: tt.InputFile, + extra?: tt.ExtraDocument + ): Promise + + /** + * Use this method to send a game + * @param chatId Unique identifier for the target chat + * @param gameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. + * @param extra Additional params for send game + * @returns a Message on success + */ + sendGame( + chatId: number | string, + gameShortName: string, + extra?: tt.ExtraGame + ): Promise + + /** + * Use this method to send invoices + * @param chatId Unique identifier for the target private chat + * @param invoice Object with new invoice params + * @param extra Additional params for send invoice + * @returns a Message on success + */ + sendInvoice( + chatId: number, + invoice: tt.NewInvoiceParameters, + extra?: tt.ExtraInvoice + ): Promise + + /** + * Use this method to send point on the map + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param latitude Latitude of location + * @param longitude Longitude of location + * @param extra Additional params for send location + * @returns a Message on success + */ + sendLocation( + chatId: number | string, + latitude: number, + longitude: number, + extra?: tt.ExtraLocation + ): Promise + + /** + * Use this method to send photos + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param photo 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 + * @param extra Additional params to send photo + * @returns a Message on success + */ + sendPhoto( + chatId: number | string, + photo: tt.InputFile, + extra?: tt.ExtraPhoto + ): Promise + + /** + * Use this method to send a group of photos or videos as an album + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param media A JSON-serialized array describing photos and videos to be sent, must include 2–10 items + * @param extra Additional params to send media group + * @returns On success, an array of the sent Messages is returned + */ + sendMediaGroup( + chatId: number | string, + media: tt.MessageMedia[], + extra?: tt.ExtraMediaGroup + ): Promise> + + /** + * Use this method to send a native poll. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param question Poll question, 1-255 characters + * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each + * @param extra Additional params to send poll + * @returns On success, the sent Message is returned. + */ + sendPoll( + chatId: number | string, + question: string, + options: string[], + extra: tt.ExtraPoll + ): Promise + + /** + * Use this method to send a native quiz. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param question Poll question, 1-255 characters + * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each + * @param extra Additional params to send quiz + * @returns On success, the sent Message is returned. + */ + sendQuiz( + chatId: number | string, + question: string, + options: string[], + extra: tt.ExtraPoll + ): Promise + + /** + * Use this method to send a native quiz. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Identifier of the original message with the poll + * @param extra Additional params to stop poll + * @returns On success, the stopped Poll with the final results is returned. + */ + stopPoll( + chatId: number | string, + messageId: number, + extra: tt.ExtraStopPoll + ): Promise + + /** + * Use this method to send .gif animations + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param animation Animation to send. Pass a file_id as String to send a GIF that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a GIF from the Internet, or upload a new GIF using multipart/form-data + * @param extra Additional params to send GIF + * @returns a Message on success + */ + sendAnimation( + chatId: number | string, + animation: tt.InputFile, + extra?: tt.ExtraAnimation + ): Promise + + /** + * Use this method to send .webp stickers + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param sticker 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 file from the Internet, or upload a new one using multipart/form-data + * @param extra Additional params to send sticker + * @returns a Message on success + */ + sendSticker( + chatId: number | string, + sticker: tt.InputFile, + extra?: tt.ExtraSticker + ): Promise + + /** + * Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document) + * Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param video 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 + * @param extra Additional params to send video + * @returns a Message on success + */ + sendVideo( + chatId: number | string, + video: tt.InputFile, + extra?: tt.ExtraVideo + ): Promise + + /** + * Use this method to send video messages + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param videoNote 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 + * @param extra Additional params to send video note + * @returns a Message on success + */ + sendVideoNote( + chatId: number | string, + videoNote: tt.InputFileVideoNote, + extra?: tt.ExtraVideoNote + ): Promise + + /** + * 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. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param voice 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 + * @param extra Additional params to send voice + * @returns a Message on success + */ + sendVoice( + chatId: number | string, + voice: tt.InputFile, + extra?: tt.ExtraVoice + ): Promise + + /** + * Use this method to send a dice, which will have a random value from 1 to 6. On success, the sent Message is returned. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!) + * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param extra Additional params to send dice + * @returns a Message on success + */ + sendDice( + chatId: number | string, + extra?: tt.ExtraDice + ): Promise + + /** + * Use this method to specify a url and receive incoming updates via an outgoing webhook + * @param url HTTPS url to send updates to. Use an empty string to remove webhook integration + * @param cert Upload your public key certificate so that the root certificate in use can be checked + * @param maxConnections Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100 + * @param allowedUpdates List the types of updates you want your bot to receive + * @returns True on success + */ + setWebhook( + url: string, + cert?: tt.InputFile, + maxConnections?: number, + allowedUpdates?: string[] + ): Promise + + /** + * Use this method to delete webhook + * @returns True on success + */ + deleteWebhook(): Promise + + /** + * Use this method to get information about set webhook + * @returns a WebhookInfo on success + */ + getWebhookInfo(): Promise + + /** + * Use this method to get basic info about a file and prepare it for downloading + * @param fileId Id of file to get link to + * @returns a File object on success + */ + getFile(fileId: string): Promise + + /** + * Use this method to get link to a file by file id + * @param fileId Id of file to get link to + * @returns a String with an url to the file + */ + getFileLink(fileId: string): Promise + + /** + * Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group 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 admin rights + * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`) + * @param userId Unique identifier of the target user + * @param untilDate 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 + * @returns True on success + */ + kickChatMember( + chatId: number | string, + userId: number, + untilDate?: number + ): Promise + + /** + * Use this method to unban a user from a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights + * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format @username) + * @param userId Unique identifier of the target user + * @returns True on success + */ + unbanChatMember(chatId: number | string, userId: number): Promise + + /** + * 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 admin rights. Pass False for all boolean parameters to demote a user. + * @param chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) + * @param userId Unique identifier of the target user + * @returns True on success + */ + promoteChatMember( + chatId: number | string, + userId: number, + extra: tt.ExtraPromoteChatMember + ): Promise + + /** + * Use this method to get updates from Telegram server. Bot should be in `polling` mode + * @returns Array of updates + */ + getUpdates(): Promise + + /** + * 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 admin rights + * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`) + * @param title New chat title, 1-255 characters + * @returns True on success + */ + setChatTitle(chatId: number | string, title: string): Promise + + /** + * Use this method to get the current list of the bot's commands. Requires no parameters. + * @returns Array of BotCommand on success. + */ + getMyCommands(): Promise + + /** + * Use this method to change the list of the bot's commands. + * @param commands A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. + * @returns True on success + */ + setMyCommands(commands: tt.BotCommand[]): Promise +} diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.d.ts b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.d.ts new file mode 100644 index 000000000..91661ab08 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.d.ts @@ -0,0 +1,3112 @@ +/** + * A placeholder, currently holds no information. Use BotFather to set up + * your game. + */ +export interface CallbackGame {} + +/** + * This object represents the content of a message to be sent as a result + * of an inline query. + */ +export type InputMessageContent = InputTextMessageContent | InputLocationMessageContent | InputVenueMessageContent | InputContactMessageContent; + +/** + * This object represents an incoming update.At most one of the optional + * parameters can be present in any given update. + * @see https://core.telegram.org/bots/api#available-types + */ +export interface Update { + /** + * 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. + * @see https://core.telegram.org/bots/api#setwebhook + */ + update_id: number; + + /** + * New incoming message of any kind — text, photo, sticker, etc. + */ + message?: Message; + + /** + * New version of a message that is known to the bot and was edited + */ + edited_message?: Message; + + /** + * New incoming channel post of any kind — text, photo, sticker, etc. + */ + channel_post?: Message; + + /** + * New version of a channel post that is known to the bot and was edited + */ + edited_channel_post?: Message; + + /** + * New incoming inline query + * @see https://core.telegram.org/bots/api#inline-mode + */ + inline_query?: InlineQuery; + + /** + * 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. + * @see https://core.telegram.org/bots/api#inline-mode + * @see https://core.telegram.org/bots/api/bots/inline#collecting-feedback + */ + chosen_inline_result?: ChosenInlineResult; + + /** + * New incoming callback query + */ + callback_query?: CallbackQuery; + + /** + * New incoming shipping query. Only for invoices with flexible price + */ + shipping_query?: ShippingQuery; + + /** + * New incoming pre-checkout query. Contains full information about checkout + */ + pre_checkout_query?: PreCheckoutQuery; +} + +/** + * Contains information about 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; + + /** + * 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; + + /** + * 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 + */ + 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 + * @see https://en.wikipedia.org/wiki/IETF_language_tag + */ + language_code?: string; +} + +/** + * This object represents a chat. + */ +export interface Chat { + /** + * Unique identifier for this chat. This number may be greater than 32 bits + * and some programming languages may have difficulty/silent defects in + * interpreting it. But it is smaller than 52 bits, so a signed 64 bit + * integer or double-precision float type are safe for storing this identifier. + */ + id: number; + + /** + * Type of chat, can be either “private”, “group”, “supergroup” or “channel” + */ + type: string; + + /** + * Title, for supergroups, channels and group chats + */ + title?: string; + + /** + * Username, for private chats, supergroups and channels if available + */ + username?: string; + + /** + * 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; + + /** + * True if a group has ‘All Members Are Admins’ enabled. + */ + all_members_are_administrators?: boolean; + + /** + * Chat photo. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + photo?: ChatPhoto; + + /** + * Description, for supergroups and channel chats. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + description?: string; + + /** + * Chat invite link, for supergroups and channel chats. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + invite_link?: string; + + /** + * Pinned message, for supergroups and channel chats. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + pinned_message?: Message; + + /** + * For supergroups, name of group sticker set. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + sticker_set_name?: string; + + /** + * True, if the bot can change the group sticker set. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + can_set_sticker_set?: boolean; +} + +/** + * This object represents a message. + */ +export interface Message { + /** + * Unique message identifier inside this chat + */ + message_id: number; + + /** + * Sender, empty for messages sent to channels + */ + from?: User; + + /** + * Date the message was sent in Unix time + */ + date: number; + + /** + * Conversation the message belongs to + */ + chat: Chat; + + /** + * For forwarded messages, sender of the original message + */ + forward_from?: User; + + /** + * For messages forwarded from channels, information about the original channel + */ + forward_from_chat?: Chat; + + /** + * For messages forwarded from channels, identifier of the original message + * in the channel + */ + forward_from_message_id?: number; + + /** + * For messages forwarded from channels, signature of the post author if present + */ + forward_signature?: string; + + /** + * For forwarded messages, date the original message was sent in Unix time + */ + forward_date?: number; + + /** + * For replies, 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?: Message; + + /** + * Date the message was last edited in Unix time + */ + edit_date?: number; + + /** + * The unique identifier of a media message group this message belongs to + */ + media_group_id?: string; + + /** + * Signature of the post author for messages in channels + */ + author_signature?: string; + + /** + * For text messages, the actual UTF-8 text of the message, 0-4096 characters. + */ + text?: string; + + /** + * For text messages, special entities like usernames, URLs, bot commands, + * etc. that appear in the text + */ + entities?: MessageEntity[]; + + /** + * For messages with a caption, special entities like usernames, URLs, bot + * commands, etc. that appear in the caption + */ + caption_entities?: MessageEntity[]; + + /** + * Message is an audio file, information about the file + */ + audio?: Audio; + + /** + * Message is a general file, information about the file + */ + document?: Document; + + /** + * Message is a game, information about the game. More about games » + * @see https://core.telegram.org/bots/api#games + */ + game?: Game; + + /** + * Message is a photo, available sizes of the photo + */ + photo?: PhotoSize[]; + + /** + * Message is a sticker, information about the sticker + */ + sticker?: Sticker; + + /** + * Message is a video, information about the video + */ + video?: Video; + + /** + * Message is a voice message, information about the file + */ + voice?: Voice; + + /** + * Message is a video note, information about the video message + * @see https://telegram.org/blog/video-messages-and-telescope + */ + video_note?: VideoNote; + + /** + * Caption for the audio, document, photo, video or voice, 0-200 characters + */ + caption?: string; + + /** + * Message is a shared contact, information about the contact + */ + contact?: Contact; + + /** + * Message is a shared location, information about the location + */ + location?: Location; + + /** + * Message is a venue, information about the venue + */ + venue?: Venue; + + /** + * 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[]; + + /** + * A member was removed from the group, information about them (this member + * may be the bot itself) + */ + left_chat_member?: User; + + /** + * A chat title was changed to this value + */ + new_chat_title?: string; + + /** + * A chat photo was change to this value + */ + new_chat_photo?: PhotoSize[]; + + /** + * Service message: the chat photo was deleted + */ + delete_chat_photo?: true; + + /** + * Service message: the group has been created + */ + group_chat_created?: true; + + /** + * 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; + + /** + * 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; + + /** + * The group has been migrated to a supergroup with the specified + * identifier. This number may be greater than 32 bits and some programming + * languages may have difficulty/silent defects in interpreting it. But it + * is smaller than 52 bits, so a signed 64 bit integer or double-precision + * float type are safe for storing this identifier. + */ + migrate_to_chat_id?: number; + + /** + * The supergroup has been migrated from a group with the specified + * identifier. This number may be greater than 32 bits and some programming + * languages may have difficulty/silent defects in interpreting it. But it + * is smaller than 52 bits, so a signed 64 bit integer or double-precision + * float type are safe for storing this identifier. + */ + migrate_from_chat_id?: number; + + /** + * 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?: Message; + + /** + * Message is an invoice for a payment, information about the invoice. More + * about payments » + * @see https://core.telegram.org/bots/api#payments + */ + invoice?: Invoice; + + /** + * Message is a service message about a successful payment, information + * about the payment. More about payments » + * @see https://core.telegram.org/bots/api#payments + */ + successful_payment?: SuccessfulPayment; + + /** + * The domain name of the website on which the user has logged in. More + * about Telegram Login » + * @see https://core.telegram.org/bots/api/widgets/login + */ + connected_website?: string; +} + +/** + * This object represents one special entity in a text message. For + * example, hashtags, usernames, URLs, etc. + */ +export interface MessageEntity { + /** + * Type of the entity. Can be mention (@username), hashtag, bot_command, + * url, email, bold (bold text), italic (italic text), code (monowidth + * string), pre (monowidth block), text_link (for clickable text URLs), + * text_mention (for users without usernames) + * @see https://telegram.org/blog/edit#new-mentions + */ + 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; + + /** + * For “text_link” only, url that will be opened after user taps on the text + */ + url?: string; + + /** + * For “text_mention” only, the mentioned user + */ + user?: User; +} + +/** + * This object represents one size of a photo or a file / sticker thumbnail. + * @see https://core.telegram.org/bots/api#document + * @see https://core.telegram.org/bots/api#sticker + */ +export interface PhotoSize { + /** + * Unique identifier for this file + */ + file_id: string; + + /** + * Photo width + */ + width: number; + + /** + * Photo height + */ + height: number; + + /** + * File size + */ + file_size?: number; +} + +/** + * This object represents an audio file to be treated as music by the + * Telegram clients. + */ +export interface Audio { + /** + * Unique identifier for this file + */ + file_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; + + /** + * MIME type of the file as defined by sender + */ + mime_type?: string; + + /** + * File size + */ + file_size?: number; +} + +/** + * This object represents a general file (as opposed to photos, voice + * messages and audio files). + * @see https://core.telegram.org/bots/api#photosize + * @see https://core.telegram.org/bots/api#voice + * @see https://core.telegram.org/bots/api#audio + */ +export interface Document { + /** + * Unique file identifier + */ + file_id: string; + + /** + * Document thumbnail as defined by sender + */ + thumb?: PhotoSize; + + /** + * Original filename as defined by sender + */ + file_name?: string; + + /** + * MIME type of the file as defined by sender + */ + mime_type?: string; + + /** + * File size + */ + file_size?: number; +} + +/** + * This object represents a video file. + */ +export interface Video { + /** + * Unique identifier for this file + */ + file_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 + */ + thumb?: PhotoSize; + + /** + * Mime type of a file as defined by sender + */ + mime_type?: string; + + /** + * File size + */ + file_size?: number; +} + +/** + * This object represents a voice note. + */ +export interface Voice { + /** + * Unique identifier for this file + */ + file_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 + */ + file_size?: number; +} + +/** + * This object represents a video message (available in Telegram apps as of v.4.0). + * @see https://telegram.org/blog/video-messages-and-telescope + */ +export interface VideoNote { + /** + * Unique identifier for this file + */ + file_id: string; + + /** + * Video width and height as defined by sender + */ + length: number; + + /** + * Duration of the video in seconds as defined by sender + */ + duration: number; + + /** + * Video thumbnail + */ + thumb?: PhotoSize; + + /** + * File size + */ + 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; +} + +/** + * This object represents a point on the map. + */ +export interface Location { + /** + * Longitude as defined by sender + */ + longitude: number; + + /** + * Latitude as defined by sender + */ + latitude: number; +} + +/** + * This object represents a venue. + */ +export interface Venue { + /** + * Venue location + */ + location: Location; + + /** + * Name of the venue + */ + title: string; + + /** + * Address of the venue + */ + address: string; + + /** + * Foursquare identifier of the venue + */ + foursquare_id?: string; +} + +/** + * 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 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. + * @see https://core.telegram.org/bots/api#getfile + */ +export interface File { + /** + * Unique identifier for this file + */ + file_id: string; + + /** + * File size, if known + */ + file_size?: number; + + /** + * File path. Use https://api.telegram.org/file/bot/ to + * get the file. + */ + file_path?: string; +} + +/** + * This object represents a custom keyboard with reply options (see + * Introduction to bots for details and examples). + * @see https://core.telegram.org/bots#keyboards + */ +export interface ReplyKeyboardMarkup { + /** + * Array of button rows, each represented by an Array of KeyboardButton objects + * @see https://core.telegram.org/bots/api#keyboardbutton + */ + keyboard: KeyboardButton[][]; + + /** + * 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; + + /** + * 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. + * @see https://core.telegram.org/bots/api#message + */ + selective?: boolean; +} + +/** + * This object represents one button of the reply keyboard. For simple text + * buttons String can be used instead of this object to specify text of the + * button. Optional fields are mutually exclusive. + */ +export interface KeyboardButton { + /** + * 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; + + /** + * 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; + + /** + * If True, the user's current location will be sent when the button is + * pressed. Available in private chats only + */ + request_location?: boolean; +} + +/** + * 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). + * @see https://core.telegram.org/bots/api#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) + * @see https://core.telegram.org/bots/api#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. + * @see https://core.telegram.org/bots/api#message + */ + selective?: boolean; +} + +/** + * This object represents an inline keyboard that appears right next to the + * message it belongs to. + * @see https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating + */ +export interface InlineKeyboardMarkup { + /** + * Array of button rows, each represented by an Array of + * InlineKeyboardButton objects + * @see https://core.telegram.org/bots/api#inlinekeyboardbutton + */ + inline_keyboard: InlineKeyboardButton[][]; +} + +/** + * This object represents one button of an inline keyboard. You must use + * exactly one of the optional fields. + */ +export interface InlineKeyboardButton { + /** + * Label text on the button + */ + text: string; + + /** + * HTTP url to be opened when button is pressed + */ + url?: string; + + /** + * Data to be sent in a callback query to the bot when button is pressed, + * 1-64 bytes + * @see https://core.telegram.org/bots/api#callbackquery + */ + callback_data?: string; + + /** + * 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.Note: This offers an easy way for users + * to start using your bot in inline mode when they are currently in a + * private chat with it. Especially useful when combined with switch_pm… + * actions – in this case the user will be automatically returned to the + * chat they switched from, skipping the chat selection screen. + * @see https://core.telegram.org/bots/api/bots/inline + * @see https://core.telegram.org/bots/api#answerinlinequery + */ + switch_inline_query?: string; + + /** + * 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; + + /** + * 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; + + /** + * Specify True, to send a Pay button.NOTE: This type of button must always + * be the first button in the first row. + * @see https://core.telegram.org/bots/api#payments + */ + pay?: boolean; +} + +/** + * 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. + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + * @see https://core.telegram.org/bots/api#inline-mode + */ +export interface CallbackQuery { + /** + * Unique identifier for this query + */ + id: string; + + /** + * Sender + */ + from: User; + + /** + * Message with the callback button that originated the query. Note that + * message content and message date will not be available if the message is + * too old + */ + message?: Message; + + /** + * 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. + * @see https://core.telegram.org/bots/api#games + */ + chat_instance: string; + + /** + * Data associated with the callback button. Be aware that a bad client can + * send arbitrary data in this field. + */ + data?: string; + + /** + * Short name of a Game to be returned, serves as the unique identifier for + * the game + * @see https://core.telegram.org/bots/api#games + */ + game_short_name?: string; +} + +/** + * 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. + * @see https://core.telegram.org/bots/api/bots#privacy-mode + */ +export interface ForceReply { + /** + * Shows reply interface to the user, as if they manually selected the + * bot‘s message and tapped ’Reply' + */ + force_reply: true; + + /** + * 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. + * @see https://core.telegram.org/bots/api#message + */ + selective?: boolean; +} + +/** + * This object represents a chat photo. + */ +export interface ChatPhoto { + /** + * Unique file identifier of small (160x160) chat photo. This file_id can + * be used only for photo download. + */ + small_file_id: string; + + /** + * Unique file identifier of big (640x640) chat photo. This file_id can be + * used only for photo download. + */ + big_file_id: string; +} + +/** + * This object contains information about one member of a chat. + */ +export interface ChatMember { + /** + * Information about the user + */ + user: User; + + /** + * The member's status in the chat. Can be “creator”, “administrator”, + * “member”, “restricted”, “left” or “kicked” + */ + status: string; + + /** + * Restricted and kicked only. Date when restrictions will be lifted for + * this user, unix time + */ + until_date?: number; + + /** + * Administrators only. True, if the bot is allowed to edit administrator + * privileges of that user + */ + can_be_edited?: boolean; + + /** + * Administrators only. True, if the administrator can change the chat + * title, photo and other settings + */ + can_change_info?: boolean; + + /** + * Administrators only. True, if the administrator can post in the channel, + * channels only + */ + can_post_messages?: boolean; + + /** + * Administrators only. True, if the administrator can edit messages of + * other users and can pin messages, channels only + */ + can_edit_messages?: boolean; + + /** + * Administrators only. True, if the administrator can delete messages of + * other users + */ + can_delete_messages?: boolean; + + /** + * Administrators only. True, if the administrator can invite new users to + * the chat + */ + can_invite_users?: boolean; + + /** + * Administrators only. True, if the administrator can restrict, ban or + * unban chat members + */ + can_restrict_members?: boolean; + + /** + * Administrators only. True, if the administrator can pin messages, + * supergroups only + */ + can_pin_messages?: boolean; + + /** + * Administrators only. True, if the administrator can add new + * administrators with a subset of his own privileges or demote + * administrators that he has promoted, directly or indirectly (promoted by + * administrators that were appointed by the user) + */ + can_promote_members?: boolean; + + /** + * Restricted only. True, if the user can send text messages, contacts, + * locations and venues + */ + can_send_messages?: boolean; + + /** + * Restricted only. True, if the user can send audios, documents, photos, + * videos, video notes and voice notes, implies can_send_messages + */ + can_send_media_messages?: boolean; + + /** + * Restricted only. True, if the user can send animations, games, stickers + * and use inline bots, implies can_send_media_messages + */ + can_send_other_messages?: boolean; + + /** + * Restricted only. True, if user may add web page previews to his + * messages, implies can_send_media_messages + */ + can_add_web_page_previews?: boolean; +} + +/** + * Contains information about why a request was unsuccessful. + */ +export interface ResponseParameters { + /** + * The group has been migrated to a supergroup with the specified + * identifier. This number may be greater than 32 bits and some programming + * languages may have difficulty/silent defects in interpreting it. But it + * is smaller than 52 bits, so a signed 64 bit integer or double-precision + * float type are safe for storing this 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; +} + +/** + * Represents a photo to be sent. + */ +export interface InputMediaPhoto { + /** + * Type of the result, must be photo + */ + type: string; + + /** + * 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. More info on + * Sending Files » + * @see https://core.telegram.org/bots/api#sending-files + */ + media: string; + + /** + * Caption of the photo to be sent, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; +} + +/** + * Represents a video to be sent. + */ +export interface InputMediaVideo { + /** + * Type of the result, must be video + */ + type: string; + + /** + * 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. More info on + * Sending Files » + * @see https://core.telegram.org/bots/api#sending-files + */ + media: string; + + /** + * Caption of the video to be sent, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Video width + */ + width?: number; + + /** + * Video height + */ + height?: number; + + /** + * Video duration + */ + duration?: number; + + /** + * Pass True, if the uploaded video is suitable for streaming + */ + supports_streaming?: boolean; +} + +/** + * This object represents a sticker. + */ +export interface Sticker { + /** + * Unique identifier for this file + */ + file_id: string; + + /** + * Sticker width + */ + width: number; + + /** + * Sticker height + */ + height: number; + + /** + * Sticker thumbnail in the .webp or .jpg format + */ + thumb?: PhotoSize; + + /** + * Emoji associated with the sticker + */ + emoji?: string; + + /** + * Name of the sticker set to which the sticker belongs + */ + set_name?: string; + + /** + * For mask stickers, the position where the mask should be placed + */ + mask_position?: MaskPosition; + + /** + * File size + */ + file_size?: number; +} + +/** + * This object represents a sticker set. + */ +export interface StickerSet { + /** + * Sticker set name + */ + name: string; + + /** + * Sticker set title + */ + title: string; + + /** + * True, if the sticker set contains masks + */ + contains_masks: boolean; + + /** + * List of all set stickers + */ + stickers: Sticker[]; +} + +/** + * 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: string; + + /** + * 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 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; + + /** + * Sender location, only for bots that request user location + */ + location?: Location; + + /** + * Text of the query (up to 512 characters) + */ + query: string; + + /** + * Offset of the results to be returned, can be controlled by the bot + */ + offset: string; +} + +/** + * Represents a link to an article or web page. + */ +export interface InlineQueryResultArticle { + /** + * Type of the result, must be article + */ + type: string; + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string; + + /** + * Thumbnail width + */ + thumb_width?: number; + + /** + * Thumbnail height + */ + thumb_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: string; + + /** + * 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 + */ + thumb_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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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: string; + + /** + * 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 + */ + gif_duration?: number; + + /** + * URL of the static thumbnail for the result (jpeg or gif) + */ + thumb_url: string; + + /** + * Title for the result + */ + title?: string; + + /** + * Caption of the GIF file to be sent, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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: string; + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string; + + /** + * A valid URL for the MP4 file. File size must not exceed 1MB + */ + mpeg4_url: string; + + /** + * Video width + */ + mpeg4_width?: number; + + /** + * Video height + */ + mpeg4_height?: number; + + /** + * Video duration + */ + mpeg4_duration?: number; + + /** + * URL of the static thumbnail (jpeg or gif) for the result + */ + thumb_url: string; + + /** + * Title for the result + */ + title?: string; + + /** + * Caption of the MPEG-4 file to be sent, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultVideo { + /** + * Type of the result, must be video + */ + type: string; + + /** + * 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 video url, “text/html” or “video/mp4” + */ + mime_type: string; + + /** + * URL of the thumbnail (jpeg only) for the video + */ + thumb_url: string; + + /** + * Title for the result + */ + title: string; + + /** + * Caption of the video to be sent, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultAudio { + /** + * Type of the result, must be audio + */ + type: string; + + /** + * 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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Performer + */ + performer?: string; + + /** + * Audio duration in seconds + */ + audio_duration?: number; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultVoice { + /** + * Type of the result, must be voice + */ + type: string; + + /** + * 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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Recording duration in seconds + */ + voice_duration?: number; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultDocument { + /** + * Type of the result, must be document + */ + type: string; + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string; + + /** + * Title for the result + */ + title: string; + + /** + * Caption of the document to be sent, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * 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: string; + + /** + * 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 + */ + thumb_url?: string; + + /** + * Thumbnail width + */ + thumb_width?: number; + + /** + * Thumbnail height + */ + thumb_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. + */ +export interface InlineQueryResultLocation { + /** + * Type of the result, must be location + */ + type: string; + + /** + * 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; + + /** + * Period in seconds for which the location can be updated, should be + * between 60 and 86400. + */ + live_period?: number; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string; + + /** + * Thumbnail width + */ + thumb_width?: number; + + /** + * Thumbnail height + */ + thumb_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. + */ +export interface InlineQueryResultVenue { + /** + * Type of the result, must be venue + */ + type: string; + + /** + * 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; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string; + + /** + * Thumbnail width + */ + thumb_width?: number; + + /** + * Thumbnail height + */ + thumb_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. + */ +export interface InlineQueryResultContact { + /** + * Type of the result, must be contact + */ + type: string; + + /** + * 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; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string; + + /** + * Thumbnail width + */ + thumb_width?: number; + + /** + * Thumbnail height + */ + thumb_height?: number; +} + +/** + * Represents a Game. + * @see https://core.telegram.org/bots/api#games + */ +export interface InlineQueryResultGame { + /** + * Type of the result, must be game + */ + type: string; + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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: string; + + /** + * 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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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: string; + + /** + * 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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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: string; + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string; + + /** + * A valid file identifier for the MP4 file + */ + mpeg4_file_id: string; + + /** + * Title for the result + */ + title?: string; + + /** + * Caption of the MPEG-4 file to be sent, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultCachedSticker { + /** + * Type of the result, must be sticker + */ + type: string; + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultCachedDocument { + /** + * Type of the result, must be document + */ + type: string; + + /** + * 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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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: string; + + /** + * 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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultCachedVoice { + /** + * Type of the result, must be voice + */ + type: string; + + /** + * 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-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ +export interface InlineQueryResultCachedAudio { + /** + * Type of the result, must be audio + */ + type: string; + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string; + + /** + * A valid file identifier for the audio file + */ + audio_file_id: string; + + /** + * Caption, 0-200 characters + */ + caption?: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + reply_markup?: InlineKeyboardMarkup; + + /** + * Content of the message to be sent instead of the audio + */ + input_message_content?: InputMessageContent; +} + +/** + * Represents the content of a text message to be sent as the result of an + * inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ +export interface InputTextMessageContent { + /** + * Text of the message to be sent, 1-4096 characters + */ + message_text: string; + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in your bot's message. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string; + + /** + * Disables link previews for links in the sent message + */ + disable_web_page_preview?: boolean; +} + +/** + * Represents the content of a location message to be sent as the result of + * an inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ +export interface InputLocationMessageContent { + /** + * Latitude of the location in degrees + */ + latitude: number; + + /** + * Longitude of the location in degrees + */ + longitude: number; + + /** + * Period in seconds for which the location can be updated, should be + * between 60 and 86400. + */ + live_period?: number; +} + +/** + * Represents the content of a venue message to be sent as the result of an + * inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ +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; +} + +/** + * Represents the content of a contact message to be sent as the result of + * an inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ +export interface InputContactMessageContent { + /** + * Contact's phone number + */ + phone_number: string; + + /** + * Contact's first name + */ + first_name: string; + + /** + * Contact's last name + */ + last_name?: string; +} + +/** + * Represents a result of an inline query that was chosen by the user and + * sent to their chat partner. + * @see https://core.telegram.org/bots/api#inlinequeryresult + */ +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. + * @see https://core.telegram.org/bots/api#inlinekeyboardmarkup + * @see https://core.telegram.org/bots/api#callbackquery + * @see https://core.telegram.org/bots/api#updating-messages + */ + inline_message_id?: string; + + /** + * The query that was used to obtain the result + */ + query: string; +} + +/** + * 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). + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + * @see https://core.telegram.org/bots/payments/currencies.json + */ + 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 + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + */ + 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). + * @see https://core.telegram.org/bots/payments/currencies.json + */ + total_amount: number; +} + +/** + * This object represents a shipping address. + */ +export interface ShippingAddress { + /** + * 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 + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + */ + 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). + * @see https://core.telegram.org/bots/payments/currencies.json + */ + total_amount: number; + + /** + * Bot specified invoice payload + */ + invoice_payload: string; + + /** + * Identifier of the shipping option chosen by the user + */ + shipping_option_id?: string; + + /** + * Order info 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 + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + */ + 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). + * @see https://core.telegram.org/bots/payments/currencies.json + */ + total_amount: number; + + /** + * Bot specified invoice payload + */ + invoice_payload: string; + + /** + * Identifier of the shipping option chosen by the user + */ + shipping_option_id?: string; + + /** + * Order info provided by the user + */ + order_info?: OrderInfo; +} + +/** + * 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. + * @see https://core.telegram.org/bots/api#setgamescore + * @see https://core.telegram.org/bots/api#editmessagetext + */ + 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 + * @see https://t.me/botfather + */ + animation?: Animation; +} + +/** + * You can provide an animation for your game so that it looks stylish in + * chats (check out Lumberjack for an example). This object represents an + * animation file to be displayed in the message containing a game. + * @see https://core.telegram.org/bots/api#game + * @see https://t.me/gamebot + * @see https://core.telegram.org/bots/api#games + */ +export interface Animation { + /** + * Unique file identifier + */ + file_id: string; + + /** + * Animation thumbnail as defined by sender + */ + thumb?: 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 + */ + file_size?: number; +} + +/** + * 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; +} \ No newline at end of file diff --git a/TaskServer/node_modules/telegram-typings/index.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.js similarity index 100% rename from TaskServer/node_modules/telegram-typings/index.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.js diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.js.flow b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.js.flow new file mode 100644 index 000000000..e0fa4bb28 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/index.js.flow @@ -0,0 +1,3114 @@ +declare module "telegram-typings" { + /** + * A placeholder, currently holds no information. Use BotFather to set up + * your game. + */ + declare type CallbackGame = {}; + + /** + * This object represents the content of a message to be sent as a result + * of an inline query. + */ + declare type InputMessageContent = InputTextMessageContent | InputLocationMessageContent | InputVenueMessageContent | InputContactMessageContent; + + /** + * This object represents an incoming update.At most one of the optional + * parameters can be present in any given update. + * @see https://core.telegram.org/bots/api#available-types + */ + declare type Update = { + /** + * 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. + * @see https://core.telegram.org/bots/api#setwebhook + */ + update_id: number, + + /** + * New incoming message of any kind — text, photo, sticker, etc. + */ + message?: Message, + + /** + * New version of a message that is known to the bot and was edited + */ + edited_message?: Message, + + /** + * New incoming channel post of any kind — text, photo, sticker, etc. + */ + channel_post?: Message, + + /** + * New version of a channel post that is known to the bot and was edited + */ + edited_channel_post?: Message, + + /** + * New incoming inline query + * @see https://core.telegram.org/bots/api#inline-mode + */ + inline_query?: InlineQuery, + + /** + * 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. + * @see https://core.telegram.org/bots/api#inline-mode + * @see https://core.telegram.org/bots/api/bots/inline#collecting-feedback + */ + chosen_inline_result?: ChosenInlineResult, + + /** + * New incoming callback query + */ + callback_query?: CallbackQuery, + + /** + * New incoming shipping query. Only for invoices with flexible price + */ + shipping_query?: ShippingQuery, + + /** + * New incoming pre-checkout query. Contains full information about checkout + */ + pre_checkout_query?: PreCheckoutQuery, + }; + + /** + * Contains information about the current status of a webhook. + */ + declare type 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, + + /** + * 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, + + /** + * 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 + */ + allowed_updates?: string[], + }; + + /** + * This object represents a Telegram user or bot. + */ + declare type 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 + * @see https://en.wikipedia.org/wiki/IETF_language_tag + */ + language_code?: string, + }; + + /** + * This object represents a chat. + */ + declare type Chat = { + /** + * Unique identifier for this chat. This number may be greater than 32 bits + * and some programming languages may have difficulty/silent defects in + * interpreting it. But it is smaller than 52 bits, so a signed 64 bit + * integer or double-precision float type are safe for storing this identifier. + */ + id: number, + + /** + * Type of chat, can be either “private”, “group”, “supergroup” or “channel” + */ + type: string, + + /** + * Title, for supergroups, channels and group chats + */ + title?: string, + + /** + * Username, for private chats, supergroups and channels if available + */ + username?: string, + + /** + * 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, + + /** + * True if a group has ‘All Members Are Admins’ enabled. + */ + all_members_are_administrators?: boolean, + + /** + * Chat photo. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + photo?: ChatPhoto, + + /** + * Description, for supergroups and channel chats. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + description?: string, + + /** + * Chat invite link, for supergroups and channel chats. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + invite_link?: string, + + /** + * Pinned message, for supergroups and channel chats. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + pinned_message?: Message, + + /** + * For supergroups, name of group sticker set. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + sticker_set_name?: string, + + /** + * True, if the bot can change the group sticker set. Returned only in getChat. + * @see https://core.telegram.org/bots/api#getchat + */ + can_set_sticker_set?: boolean, + }; + + /** + * This object represents a message. + */ + declare type Message = { + /** + * Unique message identifier inside this chat + */ + message_id: number, + + /** + * Sender, empty for messages sent to channels + */ + from?: User, + + /** + * Date the message was sent in Unix time + */ + date: number, + + /** + * Conversation the message belongs to + */ + chat: Chat, + + /** + * For forwarded messages, sender of the original message + */ + forward_from?: User, + + /** + * For messages forwarded from channels, information about the original channel + */ + forward_from_chat?: Chat, + + /** + * For messages forwarded from channels, identifier of the original message + * in the channel + */ + forward_from_message_id?: number, + + /** + * For messages forwarded from channels, signature of the post author if present + */ + forward_signature?: string, + + /** + * For forwarded messages, date the original message was sent in Unix time + */ + forward_date?: number, + + /** + * For replies, 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?: Message, + + /** + * Date the message was last edited in Unix time + */ + edit_date?: number, + + /** + * The unique identifier of a media message group this message belongs to + */ + media_group_id?: string, + + /** + * Signature of the post author for messages in channels + */ + author_signature?: string, + + /** + * For text messages, the actual UTF-8 text of the message, 0-4096 characters. + */ + text?: string, + + /** + * For text messages, special entities like usernames, URLs, bot commands, + * etc. that appear in the text + */ + entities?: MessageEntity[], + + /** + * For messages with a caption, special entities like usernames, URLs, bot + * commands, etc. that appear in the caption + */ + caption_entities?: MessageEntity[], + + /** + * Message is an audio file, information about the file + */ + audio?: Audio, + + /** + * Message is a general file, information about the file + */ + document?: Document, + + /** + * Message is a game, information about the game. More about games » + * @see https://core.telegram.org/bots/api#games + */ + game?: Game, + + /** + * Message is a photo, available sizes of the photo + */ + photo?: PhotoSize[], + + /** + * Message is a sticker, information about the sticker + */ + sticker?: Sticker, + + /** + * Message is a video, information about the video + */ + video?: Video, + + /** + * Message is a voice message, information about the file + */ + voice?: Voice, + + /** + * Message is a video note, information about the video message + * @see https://telegram.org/blog/video-messages-and-telescope + */ + video_note?: VideoNote, + + /** + * Caption for the audio, document, photo, video or voice, 0-200 characters + */ + caption?: string, + + /** + * Message is a shared contact, information about the contact + */ + contact?: Contact, + + /** + * Message is a shared location, information about the location + */ + location?: Location, + + /** + * Message is a venue, information about the venue + */ + venue?: Venue, + + /** + * 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[], + + /** + * A member was removed from the group, information about them (this member + * may be the bot itself) + */ + left_chat_member?: User, + + /** + * A chat title was changed to this value + */ + new_chat_title?: string, + + /** + * A chat photo was change to this value + */ + new_chat_photo?: PhotoSize[], + + /** + * Service message: the chat photo was deleted + */ + delete_chat_photo?: true, + + /** + * Service message: the group has been created + */ + group_chat_created?: true, + + /** + * 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, + + /** + * 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, + + /** + * The group has been migrated to a supergroup with the specified + * identifier. This number may be greater than 32 bits and some programming + * languages may have difficulty/silent defects in interpreting it. But it + * is smaller than 52 bits, so a signed 64 bit integer or double-precision + * float type are safe for storing this identifier. + */ + migrate_to_chat_id?: number, + + /** + * The supergroup has been migrated from a group with the specified + * identifier. This number may be greater than 32 bits and some programming + * languages may have difficulty/silent defects in interpreting it. But it + * is smaller than 52 bits, so a signed 64 bit integer or double-precision + * float type are safe for storing this identifier. + */ + migrate_from_chat_id?: number, + + /** + * 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?: Message, + + /** + * Message is an invoice for a payment, information about the invoice. More + * about payments » + * @see https://core.telegram.org/bots/api#payments + */ + invoice?: Invoice, + + /** + * Message is a service message about a successful payment, information + * about the payment. More about payments » + * @see https://core.telegram.org/bots/api#payments + */ + successful_payment?: SuccessfulPayment, + + /** + * The domain name of the website on which the user has logged in. More + * about Telegram Login » + * @see https://core.telegram.org/bots/api/widgets/login + */ + connected_website?: string, + }; + + /** + * This object represents one special entity in a text message. For + * example, hashtags, usernames, URLs, etc. + */ + declare type MessageEntity = { + /** + * Type of the entity. Can be mention (@username), hashtag, bot_command, + * url, email, bold (bold text), italic (italic text), code (monowidth + * string), pre (monowidth block), text_link (for clickable text URLs), + * text_mention (for users without usernames) + * @see https://telegram.org/blog/edit#new-mentions + */ + 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, + + /** + * For “text_link” only, url that will be opened after user taps on the text + */ + url?: string, + + /** + * For “text_mention” only, the mentioned user + */ + user?: User, + }; + + /** + * This object represents one size of a photo or a file / sticker thumbnail. + * @see https://core.telegram.org/bots/api#document + * @see https://core.telegram.org/bots/api#sticker + */ + declare type PhotoSize = { + /** + * Unique identifier for this file + */ + file_id: string, + + /** + * Photo width + */ + width: number, + + /** + * Photo height + */ + height: number, + + /** + * File size + */ + file_size?: number, + }; + + /** + * This object represents an audio file to be treated as music by the + * Telegram clients. + */ + declare type Audio = { + /** + * Unique identifier for this file + */ + file_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, + + /** + * MIME type of the file as defined by sender + */ + mime_type?: string, + + /** + * File size + */ + file_size?: number, + }; + + /** + * This object represents a general file (as opposed to photos, voice + * messages and audio files). + * @see https://core.telegram.org/bots/api#photosize + * @see https://core.telegram.org/bots/api#voice + * @see https://core.telegram.org/bots/api#audio + */ + declare type Document = { + /** + * Unique file identifier + */ + file_id: string, + + /** + * Document thumbnail as defined by sender + */ + thumb?: PhotoSize, + + /** + * Original filename as defined by sender + */ + file_name?: string, + + /** + * MIME type of the file as defined by sender + */ + mime_type?: string, + + /** + * File size + */ + file_size?: number, + }; + + /** + * This object represents a video file. + */ + declare type Video = { + /** + * Unique identifier for this file + */ + file_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 + */ + thumb?: PhotoSize, + + /** + * Mime type of a file as defined by sender + */ + mime_type?: string, + + /** + * File size + */ + file_size?: number, + }; + + /** + * This object represents a voice note. + */ + declare type Voice = { + /** + * Unique identifier for this file + */ + file_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 + */ + file_size?: number, + }; + + /** + * This object represents a video message (available in Telegram apps as of v.4.0). + * @see https://telegram.org/blog/video-messages-and-telescope + */ + declare type VideoNote = { + /** + * Unique identifier for this file + */ + file_id: string, + + /** + * Video width and height as defined by sender + */ + length: number, + + /** + * Duration of the video in seconds as defined by sender + */ + duration: number, + + /** + * Video thumbnail + */ + thumb?: PhotoSize, + + /** + * File size + */ + file_size?: number, + }; + + /** + * This object represents a phone contact. + */ + declare type 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, + }; + + /** + * This object represents a point on the map. + */ + declare type Location = { + /** + * Longitude as defined by sender + */ + longitude: number, + + /** + * Latitude as defined by sender + */ + latitude: number, + }; + + /** + * This object represents a venue. + */ + declare type Venue = { + /** + * Venue location + */ + location: Location, + + /** + * Name of the venue + */ + title: string, + + /** + * Address of the venue + */ + address: string, + + /** + * Foursquare identifier of the venue + */ + foursquare_id?: string, + }; + + /** + * This object represent a user's profile pictures. + */ + declare type 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 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. + * @see https://core.telegram.org/bots/api#getfile + */ + declare type File = { + /** + * Unique identifier for this file + */ + file_id: string, + + /** + * File size, if known + */ + file_size?: number, + + /** + * File path. Use https://api.telegram.org/file/bot/ to + * get the file. + */ + file_path?: string, + }; + + /** + * This object represents a custom keyboard with reply options (see + * Introduction to bots for details and examples). + * @see https://core.telegram.org/bots#keyboards + */ + declare type ReplyKeyboardMarkup = { + /** + * Array of button rows, each represented by an Array of KeyboardButton objects + * @see https://core.telegram.org/bots/api#keyboardbutton + */ + keyboard: KeyboardButton[][], + + /** + * 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, + + /** + * 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. + * @see https://core.telegram.org/bots/api#message + */ + selective?: boolean, + }; + + /** + * This object represents one button of the reply keyboard. For simple text + * buttons String can be used instead of this object to specify text of the + * button. Optional fields are mutually exclusive. + */ + declare type KeyboardButton = { + /** + * 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, + + /** + * 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, + + /** + * If True, the user's current location will be sent when the button is + * pressed. Available in private chats only + */ + request_location?: boolean, + }; + + /** + * 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). + * @see https://core.telegram.org/bots/api#replykeyboardmarkup + */ + declare type 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) + * @see https://core.telegram.org/bots/api#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. + * @see https://core.telegram.org/bots/api#message + */ + selective?: boolean, + }; + + /** + * This object represents an inline keyboard that appears right next to the + * message it belongs to. + * @see https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating + */ + declare type InlineKeyboardMarkup = { + /** + * Array of button rows, each represented by an Array of + * InlineKeyboardButton objects + * @see https://core.telegram.org/bots/api#inlinekeyboardbutton + */ + inline_keyboard: InlineKeyboardButton[][] + }; + + /** + * This object represents one button of an inline keyboard. You must use + * exactly one of the optional fields. + */ + declare type InlineKeyboardButton = { + /** + * Label text on the button + */ + text: string, + + /** + * HTTP url to be opened when button is pressed + */ + url?: string, + + /** + * Data to be sent in a callback query to the bot when button is pressed, + * 1-64 bytes + * @see https://core.telegram.org/bots/api#callbackquery + */ + callback_data?: string, + + /** + * 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.Note: This offers an easy way for users + * to start using your bot in inline mode when they are currently in a + * private chat with it. Especially useful when combined with switch_pm… + * actions – in this case the user will be automatically returned to the + * chat they switched from, skipping the chat selection screen. + * @see https://core.telegram.org/bots/api/bots/inline + * @see https://core.telegram.org/bots/api#answerinlinequery + */ + switch_inline_query?: string, + + /** + * 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, + + /** + * 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, + + /** + * Specify True, to send a Pay button.NOTE: This type of button must always + * be the first button in the first row. + * @see https://core.telegram.org/bots/api#payments + */ + pay?: boolean, + }; + + /** + * 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. + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + * @see https://core.telegram.org/bots/api#inline-mode + */ + declare type CallbackQuery = { + /** + * Unique identifier for this query + */ + id: string, + + /** + * Sender + */ + from: User, + + /** + * Message with the callback button that originated the query. Note that + * message content and message date will not be available if the message is + * too old + */ + message?: Message, + + /** + * 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. + * @see https://core.telegram.org/bots/api#games + */ + chat_instance: string, + + /** + * Data associated with the callback button. Be aware that a bad client can + * send arbitrary data in this field. + */ + data?: string, + + /** + * Short name of a Game to be returned, serves as the unique identifier for + * the game + * @see https://core.telegram.org/bots/api#games + */ + game_short_name?: string, + }; + + /** + * 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. + * @see https://core.telegram.org/bots/api/bots#privacy-mode + */ + declare type ForceReply = { + /** + * Shows reply interface to the user, as if they manually selected the + * bot‘s message and tapped ’Reply' + */ + force_reply: true, + + /** + * 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. + * @see https://core.telegram.org/bots/api#message + */ + selective?: boolean, + }; + + /** + * This object represents a chat photo. + */ + declare type ChatPhoto = { + /** + * Unique file identifier of small (160x160) chat photo. This file_id can + * be used only for photo download. + */ + small_file_id: string, + + /** + * Unique file identifier of big (640x640) chat photo. This file_id can be + * used only for photo download. + */ + big_file_id: string, + }; + + /** + * This object contains information about one member of a chat. + */ + declare type ChatMember = { + /** + * Information about the user + */ + user: User, + + /** + * The member's status in the chat. Can be “creator”, “administrator”, + * “member”, “restricted”, “left” or “kicked” + */ + status: string, + + /** + * Restricted and kicked only. Date when restrictions will be lifted for + * this user, unix time + */ + until_date?: number, + + /** + * Administrators only. True, if the bot is allowed to edit administrator + * privileges of that user + */ + can_be_edited?: boolean, + + /** + * Administrators only. True, if the administrator can change the chat + * title, photo and other settings + */ + can_change_info?: boolean, + + /** + * Administrators only. True, if the administrator can post in the channel, + * channels only + */ + can_post_messages?: boolean, + + /** + * Administrators only. True, if the administrator can edit messages of + * other users and can pin messages, channels only + */ + can_edit_messages?: boolean, + + /** + * Administrators only. True, if the administrator can delete messages of + * other users + */ + can_delete_messages?: boolean, + + /** + * Administrators only. True, if the administrator can invite new users to + * the chat + */ + can_invite_users?: boolean, + + /** + * Administrators only. True, if the administrator can restrict, ban or + * unban chat members + */ + can_restrict_members?: boolean, + + /** + * Administrators only. True, if the administrator can pin messages, + * supergroups only + */ + can_pin_messages?: boolean, + + /** + * Administrators only. True, if the administrator can add new + * administrators with a subset of his own privileges or demote + * administrators that he has promoted, directly or indirectly (promoted by + * administrators that were appointed by the user) + */ + can_promote_members?: boolean, + + /** + * Restricted only. True, if the user can send text messages, contacts, + * locations and venues + */ + can_send_messages?: boolean, + + /** + * Restricted only. True, if the user can send audios, documents, photos, + * videos, video notes and voice notes, implies can_send_messages + */ + can_send_media_messages?: boolean, + + /** + * Restricted only. True, if the user can send animations, games, stickers + * and use inline bots, implies can_send_media_messages + */ + can_send_other_messages?: boolean, + + /** + * Restricted only. True, if user may add web page previews to his + * messages, implies can_send_media_messages + */ + can_add_web_page_previews?: boolean, + }; + + /** + * Contains information about why a request was unsuccessful. + */ + declare type ResponseParameters = { + /** + * The group has been migrated to a supergroup with the specified + * identifier. This number may be greater than 32 bits and some programming + * languages may have difficulty/silent defects in interpreting it. But it + * is smaller than 52 bits, so a signed 64 bit integer or double-precision + * float type are safe for storing this 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, + }; + + /** + * Represents a photo to be sent. + */ + declare type InputMediaPhoto = { + /** + * Type of the result, must be photo + */ + type: string, + + /** + * 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. More info on + * Sending Files » + * @see https://core.telegram.org/bots/api#sending-files + */ + media: string, + + /** + * Caption of the photo to be sent, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + }; + + /** + * Represents a video to be sent. + */ + declare type InputMediaVideo = { + /** + * Type of the result, must be video + */ + type: string, + + /** + * 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. More info on + * Sending Files » + * @see https://core.telegram.org/bots/api#sending-files + */ + media: string, + + /** + * Caption of the video to be sent, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Video width + */ + width?: number, + + /** + * Video height + */ + height?: number, + + /** + * Video duration + */ + duration?: number, + + /** + * Pass True, if the uploaded video is suitable for streaming + */ + supports_streaming?: boolean, + }; + + /** + * This object represents a sticker. + */ + declare type Sticker = { + /** + * Unique identifier for this file + */ + file_id: string, + + /** + * Sticker width + */ + width: number, + + /** + * Sticker height + */ + height: number, + + /** + * Sticker thumbnail in the .webp or .jpg format + */ + thumb?: PhotoSize, + + /** + * Emoji associated with the sticker + */ + emoji?: string, + + /** + * Name of the sticker set to which the sticker belongs + */ + set_name?: string, + + /** + * For mask stickers, the position where the mask should be placed + */ + mask_position?: MaskPosition, + + /** + * File size + */ + file_size?: number, + }; + + /** + * This object represents a sticker set. + */ + declare type StickerSet = { + /** + * Sticker set name + */ + name: string, + + /** + * Sticker set title + */ + title: string, + + /** + * True, if the sticker set contains masks + */ + contains_masks: boolean, + + /** + * List of all set stickers + */ + stickers: Sticker[], + }; + + /** + * This object describes the position on faces where a mask should be + * placed by default. + */ + declare type MaskPosition = { + /** + * The part of the face relative to which the mask should be placed. One of + * “forehead”, “eyes”, “mouth”, or “chin”. + */ + point: string, + + /** + * 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 an incoming inline query. When the user sends an + * empty query, your bot could return some default or trending results. + */ + declare type InlineQuery = { + /** + * Unique identifier for this query + */ + id: string, + + /** + * Sender + */ + from: User, + + /** + * Sender location, only for bots that request user location + */ + location?: Location, + + /** + * Text of the query (up to 512 characters) + */ + query: string, + + /** + * Offset of the results to be returned, can be controlled by the bot + */ + offset: string, + }; + + /** + * Represents a link to an article or web page. + */ + declare type InlineQueryResultArticle = { + /** + * Type of the result, must be article + */ + type: string, + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string, + + /** + * Thumbnail width + */ + thumb_width?: number, + + /** + * Thumbnail height + */ + thumb_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. + */ + declare type InlineQueryResultPhoto = { + /** + * Type of the result, must be photo + */ + type: string, + + /** + * 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 + */ + thumb_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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultGif = { + /** + * Type of the result, must be gif + */ + type: string, + + /** + * 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 + */ + gif_duration?: number, + + /** + * URL of the static thumbnail for the result (jpeg or gif) + */ + thumb_url: string, + + /** + * Title for the result + */ + title?: string, + + /** + * Caption of the GIF file to be sent, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultMpeg4Gif = { + /** + * Type of the result, must be mpeg4_gif + */ + type: string, + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string, + + /** + * A valid URL for the MP4 file. File size must not exceed 1MB + */ + mpeg4_url: string, + + /** + * Video width + */ + mpeg4_width?: number, + + /** + * Video height + */ + mpeg4_height?: number, + + /** + * Video duration + */ + mpeg4_duration?: number, + + /** + * URL of the static thumbnail (jpeg or gif) for the result + */ + thumb_url: string, + + /** + * Title for the result + */ + title?: string, + + /** + * Caption of the MPEG-4 file to be sent, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultVideo = { + /** + * Type of the result, must be video + */ + type: string, + + /** + * 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 video url, “text/html” or “video/mp4” + */ + mime_type: string, + + /** + * URL of the thumbnail (jpeg only) for the video + */ + thumb_url: string, + + /** + * Title for the result + */ + title: string, + + /** + * Caption of the video to be sent, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultAudio = { + /** + * Type of the result, must be audio + */ + type: string, + + /** + * 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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Performer + */ + performer?: string, + + /** + * Audio duration in seconds + */ + audio_duration?: number, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultVoice = { + /** + * Type of the result, must be voice + */ + type: string, + + /** + * 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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Recording duration in seconds + */ + voice_duration?: number, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultDocument = { + /** + * Type of the result, must be document + */ + type: string, + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string, + + /** + * Title for the result + */ + title: string, + + /** + * Caption of the document to be sent, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * 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: string, + + /** + * 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 + */ + thumb_url?: string, + + /** + * Thumbnail width + */ + thumb_width?: number, + + /** + * Thumbnail height + */ + thumb_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. + */ + declare type InlineQueryResultLocation = { + /** + * Type of the result, must be location + */ + type: string, + + /** + * 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, + + /** + * Period in seconds for which the location can be updated, should be + * between 60 and 86400. + */ + live_period?: number, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string, + + /** + * Thumbnail width + */ + thumb_width?: number, + + /** + * Thumbnail height + */ + thumb_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. + */ + declare type InlineQueryResultVenue = { + /** + * Type of the result, must be venue + */ + type: string, + + /** + * 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, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string, + + /** + * Thumbnail width + */ + thumb_width?: number, + + /** + * Thumbnail height + */ + thumb_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. + */ + declare type InlineQueryResultContact = { + /** + * Type of the result, must be contact + */ + type: string, + + /** + * 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, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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 + */ + thumb_url?: string, + + /** + * Thumbnail width + */ + thumb_width?: number, + + /** + * Thumbnail height + */ + thumb_height?: number, + }; + + /** + * Represents a Game. + * @see https://core.telegram.org/bots/api#games + */ + declare type InlineQueryResultGame = { + /** + * Type of the result, must be game + */ + type: string, + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedPhoto = { + /** + * Type of the result, must be photo + */ + type: string, + + /** + * 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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedGif = { + /** + * Type of the result, must be gif + */ + type: string, + + /** + * 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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedMpeg4Gif = { + /** + * Type of the result, must be mpeg4_gif + */ + type: string, + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string, + + /** + * A valid file identifier for the MP4 file + */ + mpeg4_file_id: string, + + /** + * Title for the result + */ + title?: string, + + /** + * Caption of the MPEG-4 file to be sent, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedSticker = { + /** + * Type of the result, must be sticker + */ + type: string, + + /** + * 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 + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedDocument = { + /** + * Type of the result, must be document + */ + type: string, + + /** + * 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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedVideo = { + /** + * Type of the result, must be video + */ + type: string, + + /** + * 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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedVoice = { + /** + * Type of the result, must be voice + */ + type: string, + + /** + * 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-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + 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. + */ + declare type InlineQueryResultCachedAudio = { + /** + * Type of the result, must be audio + */ + type: string, + + /** + * Unique identifier for this result, 1-64 bytes + */ + id: string, + + /** + * A valid file identifier for the audio file + */ + audio_file_id: string, + + /** + * Caption, 0-200 characters + */ + caption?: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in the media caption. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Inline keyboard attached to the message + * @see https://core.telegram.org/bots/api/bots#inline-keyboards-and-on-the-fly-updating + */ + reply_markup?: InlineKeyboardMarkup, + + /** + * Content of the message to be sent instead of the audio + */ + input_message_content?: InputMessageContent, + }; + + /** + * Represents the content of a text message to be sent as the result of an + * inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ + declare type InputTextMessageContent = { + /** + * Text of the message to be sent, 1-4096 characters + */ + message_text: string, + + /** + * Send Markdown or HTML, if you want Telegram apps to show bold, italic, + * fixed-width text or inline URLs in your bot's message. + * @see https://core.telegram.org/bots/api#markdown-style + * @see https://core.telegram.org/bots/api#html-style + * @see https://core.telegram.org/bots/api#formatting-options + */ + parse_mode?: string, + + /** + * Disables link previews for links in the sent message + */ + disable_web_page_preview?: boolean, + }; + + /** + * Represents the content of a location message to be sent as the result of + * an inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ + declare type InputLocationMessageContent = { + /** + * Latitude of the location in degrees + */ + latitude: number, + + /** + * Longitude of the location in degrees + */ + longitude: number, + + /** + * Period in seconds for which the location can be updated, should be + * between 60 and 86400. + */ + live_period?: number, + }; + + /** + * Represents the content of a venue message to be sent as the result of an + * inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ + declare type 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, + }; + + /** + * Represents the content of a contact message to be sent as the result of + * an inline query. + * @see https://core.telegram.org/bots/api#inputmessagecontent + */ + declare type InputContactMessageContent = { + /** + * Contact's phone number + */ + phone_number: string, + + /** + * Contact's first name + */ + first_name: string, + + /** + * Contact's last name + */ + last_name?: string, + }; + + /** + * Represents a result of an inline query that was chosen by the user and + * sent to their chat partner. + * @see https://core.telegram.org/bots/api#inlinequeryresult + */ + declare type 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. + * @see https://core.telegram.org/bots/api#inlinekeyboardmarkup + * @see https://core.telegram.org/bots/api#callbackquery + * @see https://core.telegram.org/bots/api#updating-messages + */ + inline_message_id?: string, + + /** + * The query that was used to obtain the result + */ + query: string, + }; + + /** + * This object represents a portion of the price for goods or services. + */ + declare type 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). + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + * @see https://core.telegram.org/bots/payments/currencies.json + */ + amount: number, + }; + + /** + * This object contains basic information about an invoice. + */ + declare type 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 + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + */ + 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). + * @see https://core.telegram.org/bots/payments/currencies.json + */ + total_amount: number, + }; + + /** + * This object represents a shipping address. + */ + declare type ShippingAddress = { + /** + * 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. + */ + declare type 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. + */ + declare type 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. + */ + declare type SuccessfulPayment = { + /** + * Three-letter ISO 4217 currency code + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + */ + 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). + * @see https://core.telegram.org/bots/payments/currencies.json + */ + total_amount: number, + + /** + * Bot specified invoice payload + */ + invoice_payload: string, + + /** + * Identifier of the shipping option chosen by the user + */ + shipping_option_id?: string, + + /** + * Order info 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. + */ + declare type 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. + */ + declare type PreCheckoutQuery = { + /** + * Unique query identifier + */ + id: string, + + /** + * User who sent the query + */ + from: User, + + /** + * Three-letter ISO 4217 currency code + * @see https://core.telegram.org/bots/api/bots/payments#supported-currencies + */ + 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). + * @see https://core.telegram.org/bots/payments/currencies.json + */ + total_amount: number, + + /** + * Bot specified invoice payload + */ + invoice_payload: string, + + /** + * Identifier of the shipping option chosen by the user + */ + shipping_option_id?: string, + + /** + * Order info provided by the user + */ + order_info?: OrderInfo, + }; + + /** + * This object represents a game. Use BotFather to create and edit games, + * their short names will act as unique identifiers. + */ + declare type 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. + * @see https://core.telegram.org/bots/api#setgamescore + * @see https://core.telegram.org/bots/api#editmessagetext + */ + 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 + * @see https://t.me/botfather + */ + animation?: Animation, + }; + + /** + * You can provide an animation for your game so that it looks stylish in + * chats (check out Lumberjack for an example). This object represents an + * animation file to be displayed in the message containing a game. + * @see https://core.telegram.org/bots/api#game + * @see https://t.me/gamebot + * @see https://core.telegram.org/bots/api#games + */ + declare type Animation = { + /** + * Unique file identifier + */ + file_id: string, + + /** + * Animation thumbnail as defined by sender + */ + thumb?: 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 + */ + file_size?: number, + }; + + /** + * This object represents one row of the high scores table for a game. + */ + declare type GameHighScore = { + /** + * Position in high score table for the game + */ + position: number, + + /** + * User + */ + user: User, + + /** + * Score + */ + score: number, + }; +} \ No newline at end of file diff --git a/TaskServer/node_modules/telegram-typings/package.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/package.json similarity index 92% rename from TaskServer/node_modules/telegram-typings/package.json rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/package.json index 18e7cb384..68d2ee41b 100644 --- a/TaskServer/node_modules/telegram-typings/package.json +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/telegram-typings/-/telegram-typings-3.6.1.tgz", "_shasum": "1288d547f8694b61f1c01c2993e295f3114d9e25", "_spec": "telegram-typings@^3.6.0", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer\\node_modules\\telegraf", + "_where": "c:\\Superalgos\\Projects\\Superalgos\\TS\\Bot-Modules\\Trading-Bot\\Announcements\\node_modules\\telegraf", "author": { "name": "Sergey Sova", "email": "mail@sergeysova.com", diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/readme.md b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/readme.md new file mode 100644 index 000000000..bee7479f4 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/node_modules/telegram-typings/readme.md @@ -0,0 +1,32 @@ +# telegram-typings + +Full types parsed from core.telegram.org/bots/api for TypeScript and Flowtype + +## Installation + +Just install it as your dependency and use + +```bash +npm install --save telegram-typings +``` + +```ts +// typescript +import { User, Chat, Voice } from 'telegram-typings' +``` + +### Flow + +```bash +# Search in flow-typed +flow-typed search telegram-typings + +# if not found, copy content of ./javascript/index.js.flow to your flow-typed +wget https://raw.githubusercontent.com/sergeysova/telegram-typings/master/javascript/index.js.flow -O ./flow-typed/npm/telegram-typings_vx.x.x.js +# next use as normal module +``` + +```js +// flow +import type { User, Chat, Voice } from 'telegram-typings' +``` diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/package-lock.json b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/package-lock.json new file mode 100644 index 000000000..96eaea7e0 --- /dev/null +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Announcements/package-lock.json @@ -0,0 +1,57 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "module-alias": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", + "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "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==" + }, + "telegraf": { + "version": "3.38.0", + "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-3.38.0.tgz", + "integrity": "sha512-va4VlrKWp64JrowFoZX/NPzzA6q38kvaIukVXOWFO1V+jR1G8+hCfgJy4TX8Z3rwLJzwaBEet1QhikHDRZWl3A==", + "requires": { + "debug": "^4.0.1", + "minimist": "^1.2.0", + "module-alias": "^2.2.2", + "node-fetch": "^2.2.0", + "sandwich-stream": "^2.0.1", + "telegram-typings": "^3.6.0" + } + }, + "telegram-typings": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/telegram-typings/-/telegram-typings-3.6.1.tgz", + "integrity": "sha512-njVv1EAhIZnmQVLocZEADYUyqA1WIXuVcDYlsp+mXua/XB0pxx+PKtMSPeZ/EE4wPWTw9h/hA9ASTT6yQelkiw==" + } + } +} diff --git a/TaskServer/LowFrequencyTrading/TradingProcess.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingProcess.js similarity index 99% rename from TaskServer/LowFrequencyTrading/TradingProcess.js rename to Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingProcess.js index a3bdc61f3..39f184311 100644 --- a/TaskServer/LowFrequencyTrading/TradingProcess.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingProcess.js @@ -1,4 +1,4 @@ -exports.newTradingProcess = function (processIndex) { +exports.newSuperalgosBotModulesTradingProcess = function (processIndex) { /* This Module will load all the process data dependencies from files and send them downstream. After execution, will save the time range and status report of the process. diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/SingleMarketTradingBot.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/SingleMarketTradingBot.js index 7f663a553..a9aca7e1d 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/SingleMarketTradingBot.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/SingleMarketTradingBot.js @@ -1,7 +1,6 @@ exports.newSuperalgosBotModulesSingleMarketTradingBot = function (processIndex) { const MODULE_NAME = "Trading Bot"; - const TRADING_PROCESS_MODULE = require(TS.projects.superalgos.globals.nodeJSConstants.REQUIRE_ROOT_DIR + '/LowFrequencyTrading/TradingProcess.js'); let session = TS.projects.superalgos.botModules.tradingSession.newSuperalgosBotModulesTradingSession(processIndex) let nextLoopTimeoutHandle; @@ -261,7 +260,7 @@ TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE.write(MODULE_NAME, "[INFO] run -> loop -> initializeDataDependencies -> onInizialized -> Execution finished well.") switch (processConfig.framework.name) { case 'Low-Frequency-Trading-Process': { - processFramework = TRADING_PROCESS_MODULE.newTradingProcess(processIndex); + processFramework = TS.projects.superalgos.botModules.tradingProcess.newSuperalgosBotModulesTradingProcess(processIndex); intitializeProcessFramework(); break; } diff --git a/TaskServer/node_modules/debug/dist/debug.js b/TaskServer/node_modules/debug/dist/debug.js deleted file mode 100644 index 89ad0c217..000000000 --- a/TaskServer/node_modules/debug/dist/debug.js +++ /dev/null @@ -1,912 +0,0 @@ -"use strict"; - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -(function (f) { - if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { - module.exports = f(); - } else if (typeof define === "function" && define.amd) { - define([], f); - } else { - var g; - - if (typeof window !== "undefined") { - g = window; - } else if (typeof global !== "undefined") { - g = global; - } else if (typeof self !== "undefined") { - g = self; - } else { - g = this; - } - - g.debug = f(); - } -})(function () { - var define, module, exports; - return function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = "function" == typeof require && require; - if (!f && c) return c(i, !0); - if (u) return u(i, !0); - var a = new Error("Cannot find module '" + i + "'"); - throw a.code = "MODULE_NOT_FOUND", a; - } - - var p = n[i] = { - exports: {} - }; - e[i][0].call(p.exports, function (r) { - var n = e[i][1][r]; - return o(n || r); - }, p, p.exports, r, e, n, t); - } - - return n[i].exports; - } - - for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { - o(t[i]); - } - - return o; - } - - return r; - }()({ - 1: [function (require, module, exports) { - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var w = d * 7; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - - module.exports = function (val, options) { - options = options || {}; - - var type = _typeof(val); - - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); - } - - throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); - }; - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - - - function parse(str) { - str = String(str); - - if (str.length > 100) { - return; - } - - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); - - if (!match) { - return; - } - - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - - case 'weeks': - case 'week': - case 'w': - return n * w; - - case 'days': - case 'day': - case 'd': - return n * d; - - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - - default: - return undefined; - } - } - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtShort(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - - return ms + 'ms'; - } - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtLong(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - - return ms + ' ms'; - } - /** - * Pluralization helper. - */ - - - function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); - } - }, {}], - 2: [function (require, module, exports) { - // shim for using process in browser - var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - })(); - - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } // if setTimeout wasn't available but was latter defined - - - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - } - - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } // if clearTimeout wasn't available but was latter defined - - - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - } - - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - - draining = false; - - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - - while (len) { - currentQueue = queue; - queue = []; - - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - - queueIndex = -1; - len = queue.length; - } - - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - - queue.push(new Item(fun, args)); - - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; // v8 likes predictible objects - - - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - - process.listeners = function (name) { - return []; - }; - - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - - process.cwd = function () { - return '/'; - }; - - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - - process.umask = function () { - return 0; - }; - }, {}], - 3: [function (require, module, exports) { - /** - * 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'); - Object.keys(env).forEach(function (key) { - createDebug[key] = env[key]; - }); - /** - * Active `debug` instances. - */ - - createDebug.instances = []; - /** - * 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 for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - - function selectColor(namespace) { - var hash = 0; - - for (var 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) { - var prevTime; - - function debug() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - // Disabled? - if (!debug.enabled) { - return; - } - - var self = debug; // Set `diff` timestamp - - var curr = Number(new Date()); - var 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 - - - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } - - index++; - var formatter = createDebug.formatters[format]; - - if (typeof formatter === 'function') { - var 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); - var logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances - - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - createDebug.instances.push(debug); - return debug; - } - - function destroy() { - var index = createDebug.instances.indexOf(this); - - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - - return false; - } - - function extend(namespace, delimiter) { - var 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.names = []; - createDebug.skips = []; - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < createDebug.instances.length; i++) { - var instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } - } - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - - - function disable() { - var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { - return '-' + 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) { - if (name[name.length - 1] === '*') { - return true; - } - - var i; - var len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - - - function toNamespace(regexp) { - return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); - } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - - - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - - return val; - } - - createDebug.enable(createDebug.load()); - return createDebug; - } - - module.exports = setup; - }, { - "ms": 1 - }], - 4: [function (require, module, exports) { - (function (process) { - /* eslint-env browser */ - - /** - * This is the web browser implementation of `debug()`. - */ - exports.log = log; - exports.formatArgs = formatArgs; - exports.save = save; - exports.load = load; - exports.useColors = useColors; - exports.storage = localstorage(); - /** - * 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; - } // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - - - 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 && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$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; - } - - var 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 - - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function (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.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - - - function log() { - var _console; - - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); - } - /** - * 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() { - var r; - - try { - r = 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); - var formatters = module.exports.formatters; - /** - * 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; - } - }; - }).call(this, require('_process')); - }, { - "./common": 3, - "_process": 2 - }] - }, {}, [4])(4); -}); diff --git a/TaskServer/package-lock.json b/TaskServer/package-lock.json index 24efd9d35..da8a5d14d 100644 --- a/TaskServer/package-lock.json +++ b/TaskServer/package-lock.json @@ -8,57 +8,6 @@ "version": "1.27.45", "resolved": "https://registry.npmjs.org/ccxt/-/ccxt-1.27.45.tgz", "integrity": "sha512-4ADlbcIWDzIWjtLvsrtux5jMFj7pU4kVuiqtI2Btq6NEhQ4r/4+LirXdEFlCF6/wIU3XSHabxMd/8nu8HC1KJw==" - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - }, - "module-alias": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", - "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==" - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" - }, - "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==" - }, - "telegraf": { - "version": "3.38.0", - "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-3.38.0.tgz", - "integrity": "sha512-va4VlrKWp64JrowFoZX/NPzzA6q38kvaIukVXOWFO1V+jR1G8+hCfgJy4TX8Z3rwLJzwaBEet1QhikHDRZWl3A==", - "requires": { - "debug": "^4.0.1", - "minimist": "^1.2.0", - "module-alias": "^2.2.2", - "node-fetch": "^2.2.0", - "sandwich-stream": "^2.0.1", - "telegram-typings": "^3.6.0" - } - }, - "telegram-typings": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/telegram-typings/-/telegram-typings-3.6.1.tgz", - "integrity": "sha512-njVv1EAhIZnmQVLocZEADYUyqA1WIXuVcDYlsp+mXua/XB0pxx+PKtMSPeZ/EE4wPWTw9h/hA9ASTT6yQelkiw==" } } } diff --git a/TaskServer/package.json b/TaskServer/package.json index a9dbd791e..b8856aad5 100644 --- a/TaskServer/package.json +++ b/TaskServer/package.json @@ -13,7 +13,6 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "ccxt": "^1.25.80", - "telegraf": "^3.37.0" + "ccxt": "^1.25.80" } }