/** * Alias of `TelegramBot#startPolling()`. This is **deprecated**. * @param {Object} [options] * @return {Promise} * @deprecated */ initPolling() { deprecate('TelegramBot#initPolling() is deprecated. Use TelegramBot#startPolling() instead.'); return this.startPolling(); }
/** * Add listener for the specified [event](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events). * This is the usual `emitter.on()` method. * @param {String} event * @param {Function} listener * @see {@link https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events|Available events} * @see https://nodejs.org/api/events.html#events_emitter_on_eventname_listener */ on(event, listener) { if (_deprecatedMessageTypes.indexOf(event) !== -1) { const url = 'https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events'; deprecate(`Events ${_deprecatedMessageTypes.join(',')} are deprecated. See the updated list of events: ${url}`); } super.on(event, listener); }
/** * Handles polling against the Telegram servers. * @param {TelegramBot} bot * @see https://core.telegram.org/bots/api#getting-updates */ constructor(bot) { this.bot = bot; this.options = (typeof bot.options.polling === 'boolean') ? {} : bot.options.polling; this.options.interval = (typeof this.options.interval === 'number') ? this.options.interval : 300; this.options.params = (typeof this.options.params === 'object') ? this.options.params : {}; this.options.params.offset = (typeof this.options.params.offset === 'number') ? this.options.params.offset : 0; this.options.params.timeout = (typeof this.options.params.timeout === 'number') ? this.options.params.timeout : 10; if (typeof this.options.timeout === 'number') { deprecate('`options.polling.timeout` is deprecated. Use `options.polling.params` instead.'); this.options.params.timeout = this.options.timeout; } this._lastUpdate = 0; this._lastRequest = null; this._abort = false; this._pollingTimeout = null; }
deprecate('The method signature setWebHook(url, cert) has been deprecated since v0.25.0'); cert = options;
deprecate(`Buffers will have their filenames default to "filename" instead of "data". ${deprecationMessage}`); filename = 'data'; deprecate(`An error will no longer be thrown if file-type of buffer could not be detected. ${deprecationMessage}`); throw new errors.FatalError('Unsupported Buffer file-type'); contentType = contentType || 'application/octet-stream'; } else { deprecate(`In the future, content-type of files you send will default to "application/octet-stream". ${deprecationMessage}`);
/** * Use this method to get a list of profile pictures for a user. * Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object. * This method has an [older, compatible signature][getUserProfilePhotos-v0.25.0] * that is being deprecated. * * @param {Number} userId Unique identifier of the target user * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#getuserprofilephotos */ getUserProfilePhotos(userId, form = {}) { /* The older method signature was getUserProfilePhotos(userId, offset, limit). * We need to ensure backwards-compatibility while maintaining * consistency of the method signatures throughout the library */ if (typeof form !== 'object') { /* eslint-disable no-param-reassign, prefer-rest-params */ deprecate('The method signature getUserProfilePhotos(userId, offset, limit) has been deprecated since v0.25.0'); form = { offset: arguments[1], limit: arguments[2], }; /* eslint-enable no-param-reassign, prefer-rest-params */ } form.user_id = userId; return this._request('getUserProfilePhotos', { form }); }
_addEndpoint (endpoint) { const component = super._addEndpoint(endpoint) if (!component) return component // // Deprecate stream API. // if (endpoint.pathItem.get) { const action = endpoint.pathItem.get['x-kubernetes-action'] if (action === 'watch' || action === 'watchlist') { component.getStream = deprecate.function( component.getStream, '.getStream use .getObjectStream, see ' + 'https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md') component.getObjectStream = component._getWatchObjectStream } else if (endpoint.name === '/api/v1/namespaces/{namespace}/pods/{name}/log') { component.getStream = deprecate.function( component.getStream, '.getStream use .getByteStream, see ' + 'https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md') component.getByteStream = component._getLogByteStream } else { component.getStream = deprecate.function( component.getStream, '.getStream see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md') } } }
deprecate('Client({ config }), see ' + 'https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md')
deprecate('Request() without a .kubeconfig option, see ' + 'https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md') convertedOptions = options
/** * @deprecated Replaced by ``Connection.debug()`` and will be removed in the next major version. * @description Enables or disables the verbose mode for debugging. * @param {boolean} [flag] - Whether to enable verbose output. * @returns {boolean} The current state of the debug flag. */ debug(flag) { iConnDeprecate('As of v1.0, \'iConn.debug()\' is deprecated. Please use \'Connection.debug()\' instead'); return this.connection.debug(flag); }
/** * @deprecated Replaced by ``Connection.add()`` and will be removed in the next major version. * @description Adds XML to the command list. When an instance of iPgm or iSql is passed * ``.toXML()`` is invoked to return the underlying xml. * @param {string|object} xml - The xml to add to the command list. */ add(xml) { iConnDeprecate('As of v1.0, \'iConn.add()\' is deprecated. Please use \'Connection.add()\' instead'); this.connection.add(xml); }
/** * Use this method to receive incoming updates using long polling. * This method has an [older, compatible signature][getUpdates-v0.25.0] * that is being deprecated. * * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#getupdates */ getUpdates(form = {}) { /* The older method signature was getUpdates(timeout, limit, offset). * We need to ensure backwards-compatibility while maintaining * consistency of the method signatures throughout the library */ if (typeof form !== 'object') { /* eslint-disable no-param-reassign, prefer-rest-params */ deprecate('The method signature getUpdates(timeout, limit, offset) has been deprecated since v0.25.0'); form = { timeout: arguments[0], limit: arguments[1], offset: arguments[2], }; /* eslint-enable no-param-reassign, prefer-rest-params */ } return this._request('getUpdates', { form }); }