please add send media example, Thank you in advance.
heitumo opened this issue · 4 comments
heitumo commented
please add send media, like video, picture and voice. Thank you in advance.
tbscode commented
Also wondering about this, I've tried using the sendPhoto
api via call_method
without success.
e.g.:
data = {'chat_id': chat_id,
'photo': url, 'caption' : message}
tg.call_method('sendPhoto', data)
tbscode commented
Ok looked a little at the source code and api and it would prob rater be something like this:
data = {
'chat_id': chat_id,
'input_message_content': {
'@type': 'inputMessagePhoto',
'photo': {
'@type': 'inputFileLocal', # https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1input_file_local.html
'path': file_path,
},
},
}
tg.call_method('sendMessage', data)
I'll check later if I can get it to work.
alexander-akhmetov commented
tbscode commented
Ah I checked the issues must have overlooked that one, thanks. I've tested it (my example above) now and yes I can confirm it works.