当前位置: 首页 > 知识库问答 >
问题:

如何修复这个错误?(节点:4)UnhandledPromiseRejectionWarning:错误:Etelegram:400错误请求:找不到聊天

闾丘诚
2023-03-14

我想建立一个电报机器人。我输入了所有的数据,但后来出现了这个错误。

我试着重新装弹。

errro in getChatMember { Error: ETELEGRAM: 400 Bad Request: chat not found
    at request.then.resp (/app/node_modules/node-telegram-bot-api/src/telegram.js:280:15)
    at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:517:31)
    at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:574:18)
    at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:619:10)
    at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:699:18)
    at _drainQueueStep (/app/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/app/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/app/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
  code: 'ETELEGRAM',
  response:
   IncomingMessage {
     _readableState:
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: BufferList { head: null, tail: null, length: 0 },
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: true,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        paused: false,
        emitClose: true,
        autoDestroy: false,
        destroyed: false,
        defaultEncoding: 'utf8',
        awaitDrain: 0m,
        readingMore: 3mtrue,
        decoder: null2m,
        encoding: null },
     readable: false,
     _events:
      [Object: null prototype] {
        end: [Array],
        close: [Array],
        data: [Function],
        error: [Function] },
     _eventsCount: 4,
     _maxListeners: undefined,
     socket:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: 'api.telegram.org',
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 7,
        connecting: false,
        _hadError: false,
        _handle: [TLSWrap],
        _parent: null,
        _host: 'api.telegram.org',
        _readableState: [ReadableState],
        readable: true,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: [TLSWrap],
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: null,
        [Symbol(res)]: [TLSWrap],
        [Symbol(asyncId)]: -1,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0,
        [Symbol(connect-options)]: [Object] },
     connection:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: 'api.telegram.org',
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 7,
        connecting: false,
        _hadError: false,
        _handle: [TLSWrap],
        _parent: null,
        _host: 'api.telegram.org',
        _readableState: [ReadableState],
        readable: true,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: [TLSWrap],
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: null,
        [Symbol(res)]: [TLSWrap],
        [Symbol(asyncId)]: -1,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0,
        [Symbol(connect-options)]: [Object] },
     httpVersionMajor: 1,
     httpVersionMinor: 1,
     httpVersion: '1.1',
     complete: true,
     headers:
      { server: 'nginx/1.16.1',
        date: 'Sat, 31 Aug 2019 19:43:05 GMT',
        'content-type': 'application/json',
        'content-length': '73',
        connection: 'keep-alive',
        'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
        'access-control-allow-origin': '*',
        'access-control-expose-headers': 'Content-Length,Content-Type,Date,Server,Connection' },
     rawHeaders:
      [ 'Server',
        'nginx/1.16.1',
        'Date',
        'Sat, 31 Aug 2019 19:43:05 GMT',
        'Content-Type',
        'application/json',
        'Content-Length',
        '73',
        'Connection',
        'keep-alive',
        'Strict-Transport-Security',
        'max-age=31536000; includeSubDomains; preload',
        'Access-Control-Allow-Origin',
        '*',
        'Access-Control-Expose-Headers',
        'Content-Length,Content-Type,Date,Server,Connection' ],
     trailers: {},
     rawTrailers: [],
     aborted: false,
     upgrade: false,
     url: '',
     method: null,
     statusCode: 400,
     statusMessage: 'Bad Request',
     client:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: 'api.telegram.org',
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 7,
        connecting: false,
        _hadError: false,
        _handle: [TLSWrap],
        _parent: null,
        _host: 'api.telegram.org',
        _readableState: [ReadableState],
        readable: true,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: [TLSWrap],
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: null,
        [Symbol(res)]: [TLSWrap],
        [Symbol(asyncId)]: -1,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0,
        [Symbol(connect-options)]: [Object] },
     _consuming: false,
     _dumped: false,
     req:
      ClientRequest {
        _events: [Object],
        _eventsCount: 5,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: null,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [TLSSocket],
        connection: [TLSSocket],
        _header:
         'POST /bot935567004:AAHzn_nFK3ROZZ16TTtoENflnjuD-luYtPc/getChatMember HTTP/1.1\r\nhost: api.telegram.org\r\ncontent-type: application/x-www-form-urlencoded\r\ncontent-length: 40\r\nConnection: keep-alive\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Agent],
        socketPath: undefined,
        timeout: undefined,
        method: 'POST',
        path:
         '/bot935567004:AAHzn_nFK3ROZZ16TTtoENflnjuD-luYtPc/getChatMember',
        _ended: true,
        res: [Circular],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(isCorked)]: false,
        [Symbol(outHeadersKey)]: [Object] },
     request:
      Request {
        _events: [Object],
        _eventsCount: 5,
        _maxListeners: undefined,
        method: 'POST',
        simple: false,
        resolveWithFullResponse: true,
        forever: true,
        readable: true,
        writable: true,
        explicitMethod: true,
        _qs: [Querystring],
        _auth: [Auth],
        _oauth: [OAuth],
        _multipart: [Multipart],
        _redirect: [Redirect],
        _tunnel: [Tunnel],
        _rp_resolve: [Function],
        _rp_reject: [Function],
        _rp_promise: [Promise],
        _rp_callbackOrig: undefined,
        callback: [Function],
        _rp_options: [Object],
        headers: [Object],
        setHeader: [Function],
        hasHeader: [Function],
        getHeader: [Function],
        removeHeader: [Function],
        localAddress: undefined,
        pool: [Object],
        dests: [],
        __isRequestRequest: true,
        _callback: [Function: RP$callback],
        uri: [Url],
        proxy: null,
        tunnel: true,
        setHost: true,
        originalCookieHeader: undefined,
        _disableCookies: true,
        _jar: undefined,
        port: 443,
        host: 'api.telegram.org',
        body: 'chat_id=-1001457333935&user_id=749901319',
        path:
         '/bot935567004:AAHzn_nFK3ROZZ16TTtoENflnjuD-luYtPc/getChatMember',
        httpModule: [Object],
        agentClass: [Function],
        agentOptions: [Object],
        agent: [Agent],
        _started: true,
        href:
         'https://api.telegram.org/bot935567004:AAHzn_nFK3ROZZ16TTtoENflnjuD-luYtPc/getChatMember',
        req: [ClientRequest],
        ntick: true,
        response: [Circular],
        originalHost: 'api.telegram.org',
        originalHostHeaderName: 'host',
        responseContent: [Circular],
        _destdata: true,
        _ended: true,
        _callbackCalled: true },
     toJSON: [Function: responseToJSON],
     caseless: Caseless { dict: [Object] },
     body:
      { ok: false,
        error_code: 400,
        description: 'Bad Request: chat not found' } } }
(node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `status` of 'undefined' or 'null'.
    at TelegramBot.bot.on (/app/app.js:201:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^C

(节点:4)UnhandledPromiseRejectionWarning:

错误:Etelegram:400错误请求:在request.then.resp处找不到聊天(/app/node_modules/node-telegram-bot-api/src/telegram.js:280:15)在tryCatcher处(/app/node_modules/bluebird/js/release/util.js:16:23)在promise._settlepromiseFromHandler(/app/node_modules/bluebird/js/release/promise.js:517:31)在NdledPromiseRejectionWarning:未处理得promise拒绝.这个错误可能是由于抛出一个没有catch块的异步函数内部,或者是由于拒绝了一个未用.catch()处理的promise。(拒绝ID:1)(节点:4)[DEP0018]拒绝警告:拒绝未处理的promise。将来,未处理的promise拒绝将以非零退出代码终止node.js进程。

暂时还没有答案

 类似资料:
  • 我有一个基于Spring Web model view controller(MVC)框架的项目。Spring Web模型-视图-控制器(MVC)框架的版本是3.2.8 我有这个控制器 这个URL一切正常:

  • 目前从Angular JS controller中,我试图将JSON数据发送到后端服务。但是我有400个错误的请求错误。 在Controller中,我试图通过http服务发送数据,如下所示:

  • 我正在尝试搜索亚马逊的产品广告,并使用botlenose来帮助我做到这一点。但是,我刚刚收到HTTP错误400。 其他一些重要信息: 我来自巴西,我的标签也来自亚马逊。这是个问题吗? 我确实检查了我的钥匙、秘密和标签,一切正常。我确实在StackOverflow上查看了其他一些问题,但对我来说没有任何效果。 当然,出于安全原因,我更改了密钥。 Traceback(最近一次调用最后一次):File"

  • 我正在使用实现一个联系人应用程序。现在,我正试图通过发送以下格式的put请求来更新联系人 我将XML作为字符串发送,作为请求的主体。这是我的xmlString(请求主体) 我写了下面的代码来发送更新联系人的PUT请求。 当我试图在中发送请求时,联系人更新成功。但是当我试图运行上面的程序时,我得到了 400错误请求错误 我不知道我哪里出错了。任何帮助都将不胜感激!

  • 问题内容: 我有一段这样的代码 当我输入的查询超过一个词,例如“狗”时,出现以下错误。 谁能指出我做错了什么?提前致谢。 问题答案: “狗”返回400错误的原因是因为您没有转义URL的字符串。 如果您这样做: 会的。 但是,我强烈建议您使用请求,而不要使用urllib / urllib2 / httplib。这要容易得多,它将为您处理所有这一切。 这是与python请求相同的代码:

  • 我正在尝试使用Postman访问API,以使用基本身份验证获取响应,但当我提交数据时,它会给我带来可怕的400错误,这显然表明某些标头设置不正确。 以下是API信息: 作为回应,我应该得到一个JSON形式的加密令牌,而不是得到这个错误。 以下是邮差截图: 我错过了什么吗?