Jump to content
Registration disabled at the moment Read more... ×
Shrinavat

Clever Internet Suite and AddSubmitFile method

Recommended Posts

Hello,

I know there are advanced Clever Internet Suite users here who might be able to help me with advice.

To send an image to a Telegram channel, I use the following code:

const
  urlTGSendPhoto   = 'https://api.telegram.org/bot%s/sendPhoto';
  BOT_API_KEY      = 'xxxxxxxxxxxxxx';
  CHANNEL_NAME     = 'xxxxxxxxxxxxxx';  
...
clHttpRequest.AddFormField('chat_id', CHANNEL_NAME);
clHttpRequest.AddSubmitFile('photo', 'chart.png');
var s := clHttpTG.Post(Format(urlTGSendPhoto, [BOT_API_KEY]), clHttpRequest);

where 'chart.png' is the name of the image file on disk. It works great.

Can someone please tell me how to use a stream (TMemoryStream/TFileStream) or TPngImage/TJPEGImage/TBitmap instead of a file (that is, without the need to save the file to disk)?

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×