Hello,
here is the code.
The best way to integrate and add functions is to create another plugin. For example, create a file called telegram-bot-custom.php and upload it to wp-content/plugins, then activate it. Write the file as follows:
<?php
/*
Plugin Name: Telegram Bot & Channel (Custom)
Description: My Custom Telegram Plugin
Author: My name
Version: 1
*/
function telegram_parse_photo_s ( $telegram_user_id, $photo ) {
$plugin_post_id = telegram_getid( $telegram_user_id );
$url = telegram_download_file( $telegram_user_id, $photo[2]['file_id'] );
if ( $url ) {
telegram_sendphoto( $telegram_user_id, $caption, $url);
telegram_sendmessage( $telegram_user_id, 'Was this your photo?');
}
} add_action('telegram_parse_photo','telegram_parse_photo_s', 10, 2);
?>
I wasn’t able to send $caption, but will check asap. For now, leave it empty (you can still send a simple message after the photo).
The $photo variable defines different sizes. [2] is a good mix between weight and resolutions. You can check for the size of array and get an higher one if you want more resolution.
-
This reply was modified 8 years, 2 months ago by Marco Milesi.