telegram

A Matrix-Telegram hybrid puppeting/relaybot bridge

AGPL-3.0 License

Downloads
1.7K
Stars
1.2K
Committers
45

Bot releases are hidden (Show)

telegram - v0.15.1 Latest Release

Published by tulir 10 months ago

  • Updated Telegram API to layer 169.
  • Updated Docker image to Alpine 3.19.
  • Fixed some potential cases where a portal room would be created for the relaybot even if ignore_unbridged_group_chat was enabled.
  • Fixed member sync in groups with hidden members causing puppeted Matrix users to be kicked even if they're still in the group.
telegram - v0.15.0

Published by tulir 11 months ago

  • Removed support for MSC2716 backfilling.
  • Added add-contact and delete-contact commands.
  • Updated Telegram API layer to 166.
    • Includes receiving view-once media, blockquotes, quote replies and other such things
  • Fixed AuthKeyNotFound errors not being handled and causing users to get stuck in a non-logged-in state.
telegram - v0.14.2

Published by tulir about 1 year ago

  • Security: Updated Pillow to 10.0.1.
  • Added support for double puppeting with arbitrary as_tokens. See docs for more info.
  • Added support for sending webm and tgs files as stickers.
  • Updated to Telegram API layer 161.
  • Fixed cached usernames for Telegram users being cleared incorrectly, leading to mentions not being bridged as usernames.
  • Fixed reaction bridging failing if the server running the bridge was rebooted less than 12 hours ago.
telegram - v0.14.1

Published by tulir over 1 year ago

Added

  • Added option to delete megolm sessions that were received before the automatic ratcheting options were introduced.
  • Added config option to use IPv6 for Telegram connection (thanks to @exciler in #920).

Improved

  • Dropped support for Python 3.8.
  • Updated Docker image to Alpine 3.18.
  • Added timeout for forward backfills to prevent it from getting stuck permanently.

Fixed

  • Fixed bridge.filter.users config option not being read correctly.
  • Fixed proxy support to use python-socks instead of pysocks.
telegram - v0.14.0

Published by tulir over 1 year ago

Added

  • Added fallback messages for calls and premium gifts.
  • Added options to automatically ratchet/delete megolm sessions to minimize access to old messages.
  • Added option to not set room name/avatar even in encrypted rooms.
  • Implemented appservice pinging using MSC2659.
  • Added option to disable or filter bridging direct chats (thanks to @Steffo99 in #892).
  • Added options to specify different limits for forward and catchup backfilling depending on chat type.

Improved

  • Improved handling logouts and certain connection errors.
  • Changed reaction bridging to preserve timestamps.
  • Disabled creating portals for DMs that don't have any messages when sync_direct_chats is enabled.

Fixed

  • Fixed syncing mute status when portal is created through incoming message rather than in startup sync.
  • Fixed bridge incorrectly trusting member list and kicking users when supergroup has member list hidden.
  • Fixed sending messages after creating groups from Matrix using relaybot instead of puppet (thanks to @maltee1 in #902).
telegram - v0.13.0

Published by tulir over 1 year ago

Added

  • Added allow_contact_info config option to specify whether personal names and avatars for other users should be bridged.
    • The option is only safe to enable on single-user instances, using it anywhere else will cause ghost user profiles to flip back and forth between personal and default ones.
  • Added config option to notify Matrix room if bridging an incoming message fails.

Improved

  • Updated Docker image to Alpine 3.17.
  • Updated to Telegram API layer 152.
  • Improved handling users getting logged out.
  • Removed support for creating accounts, as Telegram only allows requesting SMS login codes on the official mobile clients now.
  • Replaced moviepy with calling ffmpeg directly for generating video thumbnails.

Fixed

  • Fixed handling Telegram chat upgrades when backfilling is enabled.
  • Fixed file transfers failing if transfering the thumbnail fails.
  • Fixed bridging unnamed files with unrecognized mime types.
  • Fixed enqueueing more backfill.
  • Fixed timestamps not being saved in telegram_file table.
  • Fixed issues with old events being replayed if the bridge was shut down uncleanly.
telegram - v0.12.2

Published by tulir almost 2 years ago

Added

  • Added built-in custom emoji packs to allow reacting with any standard unicode emoji from Matrix (note that only premium users can use custom emojis).
  • Added infinite backfill using MSC2716.
    • The new system includes a backwards compatibility mechanism which uses the old method of just sending events to the room. By default, MSC2716 is not enabled and the legacy method will be used.

Improved

  • Redacting reactions on Matrix no longer removes the user's other reactions to the same message (premium users can have up to 3 reactions per message).
  • Changes to default user permissions on Telegram are now bridged.
  • Added database index to make reaction polling more efficient (thanks to @AndrewFerr in #862).

Fixed

  • Fixed provisioning API not working with URL-encoded parameters.
telegram - v0.12.1

Published by tulir about 2 years ago

Added

  • Support for custom emojis in reactions.
    • Like other bridges with custom emoji reactions, they're bridged as mxc:// URIs, so client support is required to render them properly.

Improved

  • The bridge will now poll for reactions to 20 most recent messages when receiving a read receipt. This works around Telegram's bad protocol that doesn't notify clients on reactions to other users' messages.
  • The docker image now has an option to bypass the startup script by setting the MAUTRIX_DIRECT_STARTUP environment variable. Additionally, it will refuse to run as a non-root user if that variable is not set (and print an error message suggesting to either set the variable or use a custom command).
  • Moved environment variable overrides for config fields to mautrix-python. The new system also allows loading JSON values to enable overriding maps like login_shared_secret_map.

Fixed

  • ChatParticipantsForbidden is handled properly when syncing non-supergroup info.
  • Fixed some bugs with file transfers when using SQLite.
  • Fixed error when attempting to log in again after logging out.
  • Fixed QR login not working.
  • Fixed error syncing chats if bridging a message had previously been interrupted.
telegram - v0.12.0

Published by tulir about 2 years ago

N.B. This release requires a homeserver with Matrix v1.1 support, which bumps up the minimum homeserver versions to Synapse 1.54 and Dendrite 0.8.7. Minimum Conduit version remains at 0.4.0.

Added

  • Added provisioning API for resolving Telegram identifiers (like usernames).
  • Added support for bridging Telegram custom emojis to Matrix.
  • Added option to not bridge chats with lots of members.
  • Added option to include captions in the same message as the media to implement MSC2530. Sending captions the same way is also supported and enabled by default.
  • Added commands to kick or ban relaybot users from Telegram.
  • Added support for Telegram's disappearing messages.
  • Added support for bridging forwarded messages as forwards on Telegram.
    • Forwarding is not allowed in relay mode as the bot wouldn't be able to specify who sent the message.
    • Matrix doesn't have real forwarding (there's no forwarding metadata), so only messages bridged from Telegram can be forwarded.
    • Double puppeted messages from Telegram currently can't be forwarded without removing the fi.mau.double_puppet_source key from the content.
    • If forwarding fails (e.g. due to it being blocked in the source chat), the bridge will automatically fall back to sending it as a normal new message.
  • Added options to make encryption more secure.
    • The encryption -> verification_levels config options can be used to make the bridge require encrypted messages to come from cross-signed devices, with trust-on-first-use validation of the cross-signing master key.
    • The encryption -> require option can be used to make the bridge ignore any unencrypted messages.
    • Key rotation settings can be configured with the encryption -> rotation config.

Improved

  • Improved handling the bridge user leaving chats on Telegram, and new users being added on Telegram.
  • Improved animated sticker conversion options: added support for animated webp and added option to convert video stickers (webm) to the specified image format.
  • Audio and video metadata is now bridged properly to Telegram.
  • Added database index on Telegram usernames (used when bridging username @-mentions in messages).
  • Changed /login/send_code provisioning API to return a proper error when the phone number is not registered on Telegram.
    • The same login code can be used for registering an account, but registering is not currently supported in the provisioning API.
  • Removed plaintext_highlights config option (the code using it was already removed in v0.11.0).
  • Enabled appservice ephemeral events by default for new installations.
    • Existing bridges can turn it on by enabling ephemeral_events and disabling sync_with_custom_puppets in the config, then regenerating the registration file.
  • Updated to API layer 144 so that Telegram would send new message types like premium stickers to the bridge.
  • Updated Docker image to Alpine 3.16 and made it smaller.

Fixed

  • Fixed command prefix in game and poll messages (thanks to @cynhr in #804).
telegram - v0.11.3

Published by tulir over 2 years ago

N.B. This release drops support for old homeservers which don't support the new /v3 API endpoints. Synapse 1.48+, Dendrite 0.6.5+ and Conduit 0.4.0+ are supported. Legacy r0 API support can be temporarily re-enabled with pip install mautrix==0.16.0. However, this option will not be available in future releases.

Added

  • Added list-invite-links command to list invite links in a chat.
  • Added option to use MSC2246 async media uploads.
  • Provisioning API for listing contacts and starting private chats.

Improved

  • Dropped Python 3.7 support.
  • Telegram->Matrix message formatter will now replace t.me/c/chatid/messageid style links with a link to the bridged Matrix event (in addition to the previously supported t.me/username/messageid links).
  • Updated formatting converter to keep newlines in code blocks as \n instead of converting them to <br/>.
  • Removed max_document_size option. The bridge will now fetch the max size automatically using the media repo config endpoint.
  • Removed redundant msgtype field in sticker events sent to Matrix.
  • Disabled file logging in Docker image by default.
    • If you want to enable it, set the filename in the file log handler to a path that is writable, then add "file" back to logging.root.handlers.
  • Reactions are now marked as read when bridging read receipts from Matrix.

Fixed

  • Fixed !tg bridge throwing error if the parameter is not an integer
  • Fixed !tg bridge failing if the command had been previously run with an incorrectly prefixed chat ID (e.g. !tg bridge -1234567 followed by !tg bridge -1001234567).
  • Fixed bridge_matrix_leave config option not actually being used correctly.
  • Fixed public channel mentions always bridging into a user mention on Matrix rather than a room mention.
    • The bridge will now make room mentions if the portal exists and fall back to user mentions otherwise.
  • Fixed newlines being lost in unformatted forwarded messages.
telegram - v0.11.2

Published by tulir over 2 years ago

N.B. This will be the last release to support Python 3.7. Future versions will require Python 3.8 or higher. In general, the mautrix bridges will only support the lowest Python version in the latest Debian or Ubuntu LTS.

Added

  • Added simple fallback message for live location and venue messages from Telegram.
  • Added support for t.me/+code style invite links in !tg join.
  • Added support for showing channel profile when users send messages as a channel.
  • Added "user joined Telegram" message when Telegram auto-creates a DM chat for a new user.

Improved

  • Added option for adding a random prefix to relayed user displaynames to help distinguish them on the Telegram side.
  • Improved syncing profile info to room info when using encryption and/or the private_chat_profile_meta config option.
  • Removed legacy community_id config option.

Fixed

  • Fixed newlines disappearing when bridging channel messages with signatures.
  • Fixed login throwing an error if a previous login code expired.
  • Fixed bug in v0.11.0 that broke !tg create.
telegram - v0.11.1

Published by tulir almost 3 years ago

  • Added support for message reactions.
  • Added support for spoiler text.
  • Improved support for voice messages.
  • Improved color of blue text from Telegram to be more readable on dark themes.
  • Fixed syncing contacts throwing an error for new accounts.
  • Fixed migrating pre-v0.11 legacy databases if the database schema had been corrupted (e.g. by using 3rd party tools for SQLite -> Postgres migration).
  • Fixed converting animated stickers to webm with >33 FPS.
  • Fixed a bug in v0.11.0 that broke mentioning users in groups (thanks to @dfuchss in #724).
telegram - v0.11.0

Published by tulir almost 3 years ago

  • Switched from SQLAlchemy to asyncpg/aiosqlite.
    • The default database is now Postgres. If using SQLite, make sure you install the sqlite optional dependency.
    • Alembic is no longer used, schema migrations happen automatically on startup.
    • The automatic database migration requires you to be on the latest legacy database version. If you were running any v0.10.x version, you should be on the latest version already. Otherwise, update to v0.10.2 first, upgrade the database with alembic, then upgrade to v0.11.0 (or higher).
  • Added support for contact messages.
  • Added support for Telegram sponsored messages in channels.
    • Only applies to broadcast channels with 1000+ members (as per https://t.me/durov/172).
    • Only applies if you're using puppeting with a normal user account, because bots can't get sponsored messages.
  • Fixed non-supergroup member sync incorrectly kicking one user from the Matrix side if there was no limit on the number of members to sync (broke in v0.10.2).
  • Updated animated sticker conversion to support lottieconverter r0.2 (thanks to @sot-tech in #694).
  • Updated Docker image to Alpine 3.15.
  • Formatted all code using black and isort.
telegram - v0.10.2

Published by tulir almost 3 years ago

Deprecation unwarning

While switching away from SQLAlchemy is still planned for v0.11, SQLite is no longer deprecated and will still be supported in the future using aiosqlite.

Added

  • Added extensions when bridging unnamed files from Telegram.
  • Added support for custom bridge bot welcome messages (thanks to @justinbot in #676).

Improved

  • Improved handling authorization errors if the bridge was logged out remotely.
  • Updated room syncer to use existing power levels to find appropriate levels for admins and normal users instead of hardcoding 50 and 0.
  • Updated to Telegram API layer 133 to handle 64-bit user/chat/channel IDs.
  • Stopped logging message contents when message handling failed (thanks to @justinbot in #681).
  • Removed Element iOS compatibility hack from non-sticker files.
  • Made max_initial_member_sync work for non-supergroups too (thanks to @tadzik in #680).
  • SQLite is now supported for the crypto database. Pickle is no longer supported. If you were using pickle, the bridge will create a new e2ee session and store the data in SQLite this time.

Fixed

  • Fixed generating reply fallbacks to encrypted messages.
  • Fixed chat sync failing if the member list contained banned users.
telegram - v0.10.1

Published by tulir about 3 years ago

N.B. Docker images have moved from dock.mau.dev/tulir/mautrix-telegram to dock.mau.dev/mautrix/telegram. New versions are only available at the new path.

Added

  • Warning when bridging existing room if bridge bot doesn't have redaction permissions.
  • Custom flag to invite events that will be auto-accepted using double puppeting.
  • Custom flags for animated stickers (same as what gifs already had).

Improved

  • Updated to Telethon 1.22.
  • Updated Docker image to Alpine 3.14.

Fixed

  • Fixed Bridging Matrix location messages with additional flags in geo_uri.
  • Editing encrypted messages will no longer add an asterisk on Telegram (#623).
  • Matrix typing notifications won't be echoed back for double puppeted users anymore (#631).
  • AuthKeyDuplicatedError is now handled properly instead of making the user get stuck.
  • Fixed public_portals setting not being respected on room creation.
telegram - v0.10.0

Published by tulir over 3 years ago

Deprecation warning

v0.10 is the last release that is guaranteed to support SQLite. A future release will likely switch away from SQLAlchemy and only support Postgres. See the docs for Postgres migration instructions.

  • Added options to bridge archive, pin and mute status from Telegram to Matrix.
  • Added custom fields in Matrix events indicating Telegram gifs.
  • Allowed zero-width joiners in displaynames so things like multi-part emoji would work correctly.
  • Fixed Telegram->Matrix typing notifications.

Added

  • Support for multiple pins from/to Telegram.
  • Option to resolve redirects when joining invite links, for people who use custom URLs as invite links (#559).
  • Command to update about section in Telegram profile info (#375, thanks to @MadhuranS in #599).
  • Own read marker/unread status from Telegram is now synced to Matrix after backfilling.
  • Support for showing the individual slots in 🎰 dice rolls from Telegram.
  • Options to bridge archive, pin and mute status from Telegram to Matrix.
  • Custom fields in Matrix events indicating Telegram gifs.

Improved

  • Improved invite link regex to allow joining with less precise invite links (#554, #555).
  • Invite links can be customized with the --uses=<amount> and --expire=<delta> flags for !tg invite-link.
  • Read receipts where the target message is unknown will now cause the chat to be marked as fully read instead of the read receipt event being ignored.
  • WebP stickers are now sent as-is without converting to png.
  • Default power levels in rooms now allow enabling encryption with PL 50 if e2be is enabled in config (#471, thanks to @Rafaeltheraven in #550).
  • Updated Docker image to Alpine 3.13 and removed all edge repo stuff.
  • Allowed zero-width joiners in displaynames so things like multi-part emoji would work correctly.

Fixed

  • Matrix->Telegram location message bridging no longer flips the coordinates.
  • Fixed Telegram->Matrix typing notifications.
  • Fixed some user displaynames constantly changing between contact/non-contact names and other similar cases (#533)
telegram - v0.10.0-rc1

Published by tulir over 3 years ago

Deprecation warning

v0.10 is the last release that is guaranteed to support SQLite. A future release will likely switch away from SQLAlchemy and only support Postgres.

Added

  • Support for multiple pins from/to Telegram.
  • Option to resolve redirects when joining invite links, for people who use custom URLs as invite links (#559).
  • Command to update about section in Telegram profile info (#375, thanks to @MadhuranS in #599).
  • Own read marker/unread status from Telegram is now synced to Matrix after backfilling.
  • Support for showing the individual slots in 🎰 dice rolls from Telegram.

Improved

  • Improved invite link regex to allow joining with less precise invite links (#554, #555).
  • Invite links can be customized with the --uses=<amount> and --expire=<delta> flags for !tg invite-link.
  • Read receipts where the target message is unknown will now cause the chat to be marked as fully read instead of the read receipt event being ignored.
  • WebP stickers are now sent as-is without converting to png.
  • Default power levels in rooms now allow enabling encryption with PL 50 if e2be is enabled in config (#471, thanks to @Rafaeltheraven in #550).
  • Updated Docker image to Alpine 3.13 and removed all edge repo stuff.

Fixed

  • Matrix->Telegram location message bridging no longer flips the coordinates.
  • Fixed some user displaynames constantly changing between contact/non-contact names and other similar cases (#533)
telegram - v0.9.0

Published by tulir almost 4 years ago

  • Fixed cleaning unidentified rooms (#541)

Breaking changes

  • Prometheus metric names are now prefixed with bridge_
  • An entrypoint script is no longer automatically generated. This won't affect most users, as python -m mautrix_telegram has been the official way to start the bridge for a long time.

Added

  • Support for logging in by scanning a QR code from another Telegram client (#399).
  • Automatic backfilling of old messages when creating portals (#476).
  • Automatic backfilling of missed messages when starting bridge (#477).
  • Option to update m.direct list when using double puppeting.
  • PNG thumbnails for animated stickers when converted to webm (#467).
  • Support for receiving ephemeral events pushed directly with MSC2409 (requires Synapse 1.22 or higher).
  • Added retrying message sending if server returns 502

Improved

  • Switched end-to-bridge encryption to mautrix-python instead of a hacky matrix-nio solution.
  • End-to-bridge encryption no longer requires login_shared_secret, it uses MSC2778 instead (requires Synapse 1.21 or higher).
  • The bridge info state event is now updated whenever the chat name or avatar changes.
  • Double puppeting is no longer limited to users on the same homeserver as the bridge (#520).
  • Delivery receipts are no longer sent in unencrypted private chat portals, as the bridge bot is usually not present in them (#483).
  • Using the register command now sends a link to the Telegram terms of service.
  • The bridge_connected metric is now only set for users who are logged in.

Fixed

  • File captions are now sent as a separate message like photo captions.
  • The relaybot no longer drops Telegram messages with commands.
  • Bridging events of a user whose power level is malformed (i.e. a string instead of an integer) now works (#526).
  • Fixed bug where syncing members sometimes kicked ghosts of users who were actually still in the chat.
  • Logging out will now delete private chat portals, instead of only kicking the user and leaving the portal in a broken state (#397).
  • Unbridging direct chat portals is now possible (#495).
telegram - v0.9.0-rc3

Published by tulir almost 4 years ago

Added

  • Added retrying message sending if server returns 502

Fixed

  • Fixed Matrix → Telegram name mentions
  • Fixed some bugs with replies
telegram - v0.9.0-rc2

Published by tulir almost 4 years ago

Improved

  • Ephemeral event handling should be faster by not checking the database for user existence.
  • Using the register command now sends a link to the Telegram terms of service.
  • The bridge_connected metric is now only set for users who are logged in.

Fixed

  • Fixed bug where syncing members sometimes kicked ghosts of users who were actually still in the chat.
  • Fixed sending captions to Telegram with !tg caption (broken in rc1).
  • Logging out will now delete private chat portals, instead of only kicking the user and leaving the portal in a broken state (#397).
  • Unbridging direct chat portals is now possible (#495).