alik0211 / mtproto-core

Telegram API JS (MTProto) client library for Node.js and browser
https://mtproto-core.js.org
GNU General Public License v3.0
631 stars 117 forks source link

how to call messages.forwardMessages #266

Closed skyisboss closed 2 years ago

skyisboss commented 2 years ago

Here is the sample code

await api.call('messages.forwardMessages', {
    id: [70],
    from_peer: {
      _: 'inputPeerChannel',
      channel_id: 123,
      access_hash: '123'
    },
    to_peer: {
      _: 'inputPeerChannel',
      channel_id: 456,
      access_hash: '456'
    }
  })

and then get this result

messages.forwardMessages error: TypeError: Cannot read properties of undefined (reading 'length')
    at Counter.vector (D:\mtproto\node_modules\@mtproto\core\src\tl\counter\index.js:93:31)
    at Counter.messages.forwardMessages (D:\mtproto\node_modules\@mtproto\core\src\tl\builder\index.js:6104:10)
    at Counter.predicate (D:\mtproto\node_modules\@mtproto\core\src\tl\counter\index.js:101:8)
    at Counter.initConnection (D:\mtproto\node_modules\@mtproto\core\src\tl\builder\index.js:6306:10)
    at Counter.predicate (D:\mtproto\node_modules\@mtproto\core\src\tl\counter\index.js:101:8)
    at Counter.invokeWithLayer (D:\mtproto\node_modules\@mtproto\core\src\tl\builder\index.js:6351:10)
    at new Counter (D:\mtproto\node_modules\@mtproto\core\src\tl\counter\index.js:7:8)
    at new Serializer (D:\mtproto\node_modules\@mtproto\core\src\tl\serializer\index.js:7:21)
    at RPC.call (D:\mtproto\node_modules\@mtproto\core\src\rpc\index.js:591:24)
    at Object.call (D:\mtproto\node_modules\@mtproto\core\src\index.js:106:32)
D:\mtproto\node_modules\@mtproto\core\src\tl\counter\index.js:93
    for (let i = 0; i < value.length; i++) {
skyisboss commented 2 years ago

update random_id is required