Delivers Sexy.Utils.Object structs to Telegram and manages the message lifecycle.
This is the engine behind Sexy.Bot.send/2. You typically don't call it directly.
How it works
- Detects content type via
Sexy.Utils.Object.detect_object_type/1 - Calls the appropriate
Sexy.Bot.Apimethod (send_message,send_photo,send_document, etc.) - If
update_mid: true(default):- Deletes the old message via
Session.get_message_id/1 - Saves the new message id via
Session.on_message_sent/4
- Deletes the old message via
Content type detection
| Object field | Type | API method |
|---|---|---|
media: nil | text | sendMessage |
upload_type: :document (or media: "file") | document | sendDocument (multipart) |
upload_type: :photo | photo | sendPhoto (multipart) |
upload_type: :video | video | sendVideo (multipart) |
upload_type: :animation | animation | sendAnimation (multipart) |
media starts with "A" | photo | sendPhoto (by file_id) |
media starts with "B" | video | sendVideo (by file_id) |
media starts with "C" | animation | sendAnimation (by file_id) |
Summary
Functions
Send an Object (or list of Objects) to Telegram.
Types
@type tg_response() :: map()
Functions
@spec deliver( Sexy.Utils.Object.t() | [Sexy.Utils.Object.t()], keyword() ) :: tg_response() | :ok
Send an Object (or list of Objects) to Telegram.
Options
:update_mid—true(default) to delete old message and save new mid,falseto send without modifying screen state