gramjs icon indicating copy to clipboard operation
gramjs copied to clipboard

InputMediaPhotoExternal doesn't work in client.sendMessage

Open lybrus opened this issue 2 years ago • 4 comments

await client.sendMessage(peer, {
  file: [new Api.InputMediaPhotoExternal({
    url: 'some url'
  })],
  message: 'some message'
})

This code throws an exception RPCError: 400: MEDIA_INVALID (caused by messages.UploadMedia)

But this code works

await client.invoke(
  new Api.messages.SendMedia({
    peer,
    media: new Api.InputMediaPhotoExternal({
      url: 'some url'
    }),
    message: 'some message'
  })
)

I expect that client.sendMessage will work. This method is more convenient to work with. I need to send several photos in one message, but it seems Api.messages.SendMultiMedia doesn't work with InputMediaPhotoExternal

lybrus avatar Feb 26 '23 19:02 lybrus