Skip to content

v0.2.0-alpha.1

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 27 Oct 13:13
· 1 commit to main since this release

Added

  • Albums, live photos and replies from other chats are decoded. Message
    gained MediaGroupID, LivePhoto, ExternalReply and HasMediaSpoiler, with
    the types behind them: LivePhoto, ExternalReplyInfo, MessageOrigin and
    the Origin* constants. Telegram sends every item of an album as its own
    update, and MediaGroupID is what ties them together. A live photo fills
    Photo as well as LivePhoto, so a bot that sorts attachments checks
    LivePhoto first, as it does with Animation before Document. A reply to a
    message in another chat or another topic arrives in ExternalReply, not in
    ReplyToMessage. ExternalReplyInfo models the attachments and the origin;
    the rest of the object is in Message.Raw. The Bot API version stays at 10.3:
    live photos are from 10.0.
  • Three more button kinds. InlineKeyboardButton gained WebApp
    (WebAppInfo), LoginURL (LoginURL) and CopyText (CopyTextButton). A
    bot that kept its own keyboard type only for web_app, and edited the buttons
    in after a photo upload, can send the photo with its buttons in one call.
    Telegram accepts web_app only in a private chat; the field comment says so.
    The struct comment now lists the actions a button can carry. This package
    still does not check that exactly one is set.
  • SendAnimation and InputMediaAnimation. SendAnimation takes the same
    files as SendVideo: a file_id or a URL, a path on a --local server, or an
    upload, which is multipart on its own. AnimationOptions has the caption
    options, width, height, duration, ShowCaptionAboveMedia and HasSpoiler.
    InputMediaAnimation is the same animation for EditMessageMedia, so a photo
    can turn into a loop in place. maply uploaded an MP4 as a document with its own
    HTTP client to get an animation; this replaces that, with tg's retries and
    token redaction. Telegram does not accept an animation in an album, so
    SendMediaGroup refuses one before sending anything. sendAnimation is in
    probeSafe: with no file the server answers "There is no animation in the
    request" before it does anything, so Needs.Methods can name it.
  • EditMessageMediaMessage returns the edited Message. The file_id of a
    file an edit uploaded is only in that answer, and EditMessageMedia threw it
    away. The new method takes the same arguments and returns (Message, error).
    Unlike EditMessageMedia, it returns "message is not modified" as the error
    (IsMessageNotModified) instead of swallowing it, because there is no message
    to return and a zero Message with a nil error would look like an edit that
    worked. An edit of an inline message is still not possible: it needs the
    inline_message_id work and returns true, not a message.
  • Caption options on the media types. InputMediaPhoto, InputMediaVideo
    and InputMediaAnimation take ShowCaptionAboveMedia and HasSpoiler, in an
    edit and in an album. The caption was already HTML, so a caption and its
    placement go in the same call as the media.
  • EditMessageCaption. Replaces the caption of a message the bot sent and
    returns the edited Message: an HTML caption, EditCaptionOptions with the
    keyboard and ShowCaptionAboveMedia. An empty caption removes it, and is sent
    as an empty string. Like EditMessageMediaMessage it returns "message is not
    modified" as the error, which a bot editing on a timer ignores with
    IsMessageNotModified. editMessageCaption was already in probeSafe, and
    the server answers an empty body with "Message identifier is not specified".
  • Reactions and batch delete. SetMessageReaction sets the bot's own
    reaction and replaces the previous one; an empty list removes it.
    DeleteMessages deletes 1 to 100 messages in one call and refuses any other
    count before sending. DeleteMessageReaction (Bot API 10.0) takes a
    ReactionActor, a user or a chat, and removes that actor's reaction. It is a
    moderation method for groups and supergroups and needs the right to delete
    messages: it cannot take back the bot's own reaction, so the bot does that
    with SetMessageReaction and no reactions. Telegram accepts only the emoji in
    the Bot API reference list for a bot's reaction, and the check mark is not in
    it, so a "done" mark has to be another emoji. setMessageReaction was already
    in probeSafe; deleteMessages and deleteMessageReaction join it, so
    Needs.Methods can name all three. The server source answers an empty body
    with "Message identifiers are not specified" and "chat_id is empty" before it
    calls TDLib.
  • Menu button and profile texts. SetChatMenuButton takes a MenuButton
    (MenuCommands, MenuWebApp with Text and WebApp, or MenuDefault) and a
    private chat; chat 0 sets the default for every private chat. A web_app button
    without its text or URL and an unknown kind are refused before sending.
    SetMyDescription and SetMyShortDescription take the text and a language
    code, empty for the default. An empty text is sent as an empty string, because
    that is how Telegram is told to drop the text of a language. maply and framy
    both set these at start; maply did it through Call. None of the three is in
    probeSafe, and a test now says so: with an empty body setMyDescription and
    setMyShortDescription clear the text, and setChatMenuButton resets the
    button.
  • Downloads reach the Observer. DownloadToFile reports one Event when
    it finishes, successful or not. Method is downloadFile for a transfer over
    HTTP and readLocalFile for a read from the disk of a --local server. The
    second has no request, so its Status is 0 and a success is told by Err
    being nil. Duration covers the whole transfer, and the new Event.Bytes is
    what was written to the destination, 0 for every other event. Retryable says
    whether another try could pass (the network, a 429, a 5xx), but a download is
    still one attempt and Attempt is 1. A file over the limit is not retryable,
    and Bytes counts what was written before it was rejected. Err is the error
    DownloadToFile returns, so it holds no token. A bot that counts every event
    by Method gets two new values, and one that treats Status == 0 as "no
    answer" has to check Err first for readLocalFile.