You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/2/send-msg/media-msg.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,3 +195,13 @@ var messages = await bot.SendMediaGroup(chatId, new IAlbumInputMedia[]
195
195
```
196
196
197
197
Note that media groups can't have reply markup. The caption must be set on one of the media (usually the first)
198
+
199
+
### Receiving a media group (album)
200
+
201
+
When your bot [receives updates](../../3/updates/README.md) for a media group, it will appear as separate messages _(one per media, usually consecutive)_ having the same `MediaGroupId` property.
202
+
203
+
You should collect them progressively as you receive those messages.
204
+
There is no way to know how many medias are in the album, so here are some techniques:
205
+
- look for consecutive messages in that chat with same `MediaGroupId` and stop when it's not the same
206
+
- stop after 10 medias in the group (maximum)
207
+
- use a timeout of a few seconds not receiving new messages in that chat to determine the end
Copy file name to clipboardExpand all lines: src/FAQ.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,9 +62,11 @@ You can't. Bots can only send private messages to users that have already initia
62
62
You would have received an `update.MyChatMember` with `NewChatMember.Status == ChatMemberStatus.Kicked`
63
63
If you didn't record that info, you can try to `SendChatAction` and see if it raises an exception.
64
64
65
-
### _12. How to set a caption to a media group (album)?_
65
+
### _12. How to set a caption and ReplyMarkup to a media group (album)?_
66
66
Set the `media.Caption` (and `media.ParseMode`) on the first or last media
67
67
68
+
Media groups can't have Reply Markup unfortunately.
69
+
68
70
### _13. How to write a bot that make questions/answers with users?_
69
71
Either you can code a complex state machine workflow, saving where each user is currently in the discussion tree.
70
72
Or you can just use [YourEasyBot](https://github.com/wiz0u/YourEasyBot) which makes sequential bots very simple to write... _(or one of the [other frameworks](https://github.com/TelegramBots/Telegram.Bot/wiki) available for Telegram.Bot)_
@@ -100,11 +102,9 @@ Alternatively, you can call `await bot.DropPendingUpdates()` before polling or u
100
102
- If you send a media group, make sure you specify different filenames on `InputFile.FromStream`
101
103
102
104
### _21. How to fetch all medias from an album/media group ?_
103
-
Medias in a media group are received as separate consecutive messages having the same `MediaGroupId` property. You should collect them progressively as you receive those messages.
104
-
There is no way to know how many medias are in the album, so:
105
-
- look for consecutive messages in that chat with same `MediaGroupId` and stop when it's not the same
106
-
- stop after 10 medias in the group (maximum)
107
-
- use a timeout of a few seconds not receiving new messages in that chat to determine the end
105
+
When receiving a media group, you need to collect the series of separate messages in a chat having the same `MediaGroupId` property.
106
+
There is no way to know how many medias/messages the album is composed of.
107
+
[Read more here](2/send-msg/media-msg.md#receiving-a-media-group-album)
0 commit comments