|
9 | 9 | #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) |
10 | 10 |
|
11 | 11 | /* Local sample media paths */ |
12 | | -#define SAMPLE_PHOTO "samples/logo.png" |
13 | | -#define SAMPLE_AUDIO "samples/audio.mp3" |
14 | | -#define SAMPLE_VIDEO "samples/video.mp4" |
15 | | -#define SAMPLE_DOC "samples/document.md" |
16 | | -#define SAMPLE_ANIMATION "samples/animation.gif" |
17 | | -#define SAMPLE_VOICE "samples/voice.wav" |
| 12 | +#define SAMPLE_PHOTO "test/samples/logo.png" |
| 13 | +#define SAMPLE_AUDIO "test/samples/audio.mp3" |
| 14 | +#define SAMPLE_VIDEO "test/samples/video.mp4" |
| 15 | +#define SAMPLE_DOC "test/samples/document.md" |
| 16 | +#define SAMPLE_ANIMATION "test/samples/animation.gif" |
| 17 | +#define SAMPLE_VOICE "test/samples/voice.wav" |
18 | 18 |
|
19 | 19 | void setup_commands(telebot_handler_t handle) |
20 | 20 | { |
@@ -70,7 +70,7 @@ void handle_message(telebot_handler_t handle, telebot_message_t *message) |
70 | 70 | "{\"text\":\"Document\",\"callback_data\":\"media_doc\"}]," |
71 | 71 | "[{\"text\":\"Animation\",\"callback_data\":\"media_animation\"}," |
72 | 72 | "{\"text\":\"Voice\",\"callback_data\":\"media_voice\"}]]}"; |
73 | | - ret = telebot_send_message(handle, message->chat->id, "Select media to send (from local files):", "", false, false, 0, keyboard); |
| 73 | + ret = telebot_send_message(handle, message->chat->id, "Select media to send:", "", false, false, 0, keyboard); |
74 | 74 | } |
75 | 75 | else if (strstr(message->text, "/keyboard")) |
76 | 76 | { |
@@ -149,29 +149,39 @@ void handle_callback_query(telebot_handler_t handle, telebot_callback_query_t *q |
149 | 149 | telebot_error_e ret = TELEBOT_ERROR_NONE; |
150 | 150 | long long int chat_id = query->message->chat->id; |
151 | 151 |
|
| 152 | + int duration = 0; |
| 153 | + int width = 0; |
| 154 | + int height = 0; |
| 155 | + const char *thumb = NULL; |
| 156 | + bool disable_notification = false; |
| 157 | + int reply_to_message_id = 0; |
| 158 | + const char *reply_markup = NULL; |
| 159 | + const char *parse_mode = ""; |
| 160 | + bool is_file = true; |
| 161 | + |
152 | 162 | if (strcmp(query->data, "media_photo") == 0) |
153 | 163 | { |
154 | | - ret = telebot_send_photo(handle, chat_id, SAMPLE_PHOTO, true, "Test Photo from local file", "", false, 0, ""); |
| 164 | + ret = telebot_send_photo(handle, chat_id, SAMPLE_PHOTO, is_file, "Test Photo", parse_mode, disable_notification, reply_to_message_id, reply_markup); |
155 | 165 | } |
156 | 166 | else if (strcmp(query->data, "media_audio") == 0) |
157 | 167 | { |
158 | | - ret = telebot_send_audio(handle, chat_id, SAMPLE_AUDIO, true, "Test Audio from local file", "", 0, "Artist", "Title", "", false, 0, ""); |
| 168 | + ret = telebot_send_audio(handle, chat_id, SAMPLE_AUDIO, is_file, "Test Audio", parse_mode, duration, "Artist", "Title", parse_mode, disable_notification, reply_to_message_id, reply_markup); |
159 | 169 | } |
160 | 170 | else if (strcmp(query->data, "media_video") == 0) |
161 | 171 | { |
162 | | - ret = telebot_send_video(handle, chat_id, SAMPLE_VIDEO, true, 0, 0, 0, "", "Test Video from local file", "", false, false, 0, ""); |
| 172 | + ret = telebot_send_video(handle, chat_id, SAMPLE_VIDEO, is_file, duration, width, height, thumb, "Test Video", parse_mode, disable_notification, false, reply_to_message_id, reply_markup); |
163 | 173 | } |
164 | 174 | else if (strcmp(query->data, "media_doc") == 0) |
165 | 175 | { |
166 | | - ret = telebot_send_document(handle, chat_id, SAMPLE_DOC, true, "", "Test Document from local file", "", false, 0, ""); |
| 176 | + ret = telebot_send_document(handle, chat_id, SAMPLE_DOC, is_file, thumb, "Test Document", parse_mode, disable_notification, reply_to_message_id, reply_markup); |
167 | 177 | } |
168 | 178 | else if (strcmp(query->data, "media_animation") == 0) |
169 | 179 | { |
170 | | - ret = telebot_send_animation(handle, chat_id, SAMPLE_ANIMATION, true, 0, 0, 0, "", "Test Animation from local file", "", false, 0, ""); |
| 180 | + ret = telebot_send_animation(handle, chat_id, SAMPLE_ANIMATION, is_file, duration, width, height, thumb, "Test Animation", parse_mode, disable_notification, reply_to_message_id, reply_markup); |
171 | 181 | } |
172 | 182 | else if (strcmp(query->data, "media_voice") == 0) |
173 | 183 | { |
174 | | - ret = telebot_send_voice(handle, chat_id, SAMPLE_VOICE, true, "Test Voice from local file", "", 0, false, 0, ""); |
| 184 | + ret = telebot_send_voice(handle, chat_id, SAMPLE_VOICE, is_file, "Test Voice", parse_mode, duration, disable_notification, reply_to_message_id, reply_markup); |
175 | 185 | } |
176 | 186 |
|
177 | 187 | /* Acknowledge callback query */ |
|
0 commit comments