Skip to content

Commit fc52c8e

Browse files
committed
faq media group
1 parent 0f5be6d commit fc52c8e

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/2/send-msg/media-msg.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,13 @@ var messages = await bot.SendMediaGroup(chatId, new IAlbumInputMedia[]
195195
```
196196

197197
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

src/FAQ.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ You can't. Bots can only send private messages to users that have already initia
6262
You would have received an `update.MyChatMember` with `NewChatMember.Status == ChatMemberStatus.Kicked`
6363
If you didn't record that info, you can try to `SendChatAction` and see if it raises an exception.
6464

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)?_
6666
Set the `media.Caption` (and `media.ParseMode`) on the first or last media
6767

68+
Media groups can't have Reply Markup unfortunately.
69+
6870
### _13. How to write a bot that make questions/answers with users?_
6971
Either you can code a complex state machine workflow, saving where each user is currently in the discussion tree.
7072
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
100102
- If you send a media group, make sure you specify different filenames on `InputFile.FromStream`
101103

102104
### _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)
108108

109109
### _22. How to send a custom emoji❓_
110110
⚠️ It costs about ~$5,000 !! 😱

0 commit comments

Comments
 (0)