Commit Graph

91 Commits (addtengodownload)

Author SHA1 Message Date
Ben Wiederhake b2af76e7dc
Support Telegram animated stickers (tgs) format (#1173)
This is half a fix for #874

This patch introduces a new config flag:
- MediaConvertTgs

These need to be treated independently from the existing
MediaConvertWebPToPNG flag because Tgs→WebP results in an
*animated* WebP, and the WebP→PNG converter can't handle
animated WebP files yet.

Furthermore, some platforms (like discord) don't even support
animated WebP files, so the user may want to fall back to
static PNGs (not APNGs).

The final reason why this is only half a fix is that this
introduces an external dependency, namely lottie, to be
installed like this:

$ pip3 install lottie cairosvg

This patch works by writing the tgs to a temporary file in /tmp,
calling lottie to convert it (this conversion may take several seconds!),
and then deleting the temporary file.
The temporary file is absolutely necessary, as lottie refuses to
work on non-seekable files.
If anyone comes up with a reasonable use case where /tmp is
unavailable, I can add yet another config option for that, if desired.

Telegram will bail out if the option is configured but lottie isn't found.
4 years ago
Andrey Groshev a94fe55886
Fix MarkdownV2 support in Telegram (#1169) 4 years ago
Wim 274fb09ed4
Fix forward from hidden users (telegram). Closes #1131 (#1143)
Use ForwardDate to check if a message is forwarded.
If we have a nil ForwardedFrom then make this an unknown user.
4 years ago
Wim e343db6f72
Make avatars download work with mediaserverdownload (telegram). Fixes #920 (#1012) 4 years ago
Wim f8ad877601
Add DisableWebPagePreview option (telegram). Closes #980 (#994) 4 years ago
Humorhenker fc30b1bacc
Add QuoteLengthLimit option (telegram) fixes #963 (#985)
* QuoteLengthLimit option added to limit max. quoted message length if QuoteLengthLimit = 0 the whole message will be quoted
4 years ago
Guillaume Lazzara c9d5f4c898 Add support for WhatsApp media (jpeg/png/gif) bridging (#974)
* Whatsapp image bridging

* Prevent double message in telegram when media with caption received

Co-authored-by: imShara <shara@protonmail.com>
5 years ago
Wim 1fb91c6316
Fix panic by checking slice bounds in handleEntities (telegram). Fixes #857 (#858)
Besides the bound checking, this now also use utf16 as suggested by
https://github.com/go-telegram-bot-api/telegram-bot-api/issues/231
5 years ago
Wim 01d0a9f412 Handle nil message (telegram). Fixes #777 5 years ago
Wim 8cc2d3b4fe Revert "Bail if any vars are nil, not if all (telegram) (#778)"
This reverts commit efd2c99862.
5 years ago
David Hill efd2c99862 Bail if any vars are nil, not if all (telegram) (#778) 5 years ago
Wim f57370f33a
Add support for URL in messageEntities (telegram). Fixes #735 (#736) 5 years ago
Wim 26a7e35f27
Add MediaConvertWebPToPNG option (telegram). (#741)
* Add MediaConvertWebPToPNG option (telegram).

When enabled matterbridge will convert .webp files to .png files
before uploading them to the mediaserver of the other bridges.

Fixes #398
5 years ago
Wim 96841c70c7 Fix regression in HTML handling (telegram). Closes #734
* Revert back to blackfriday v1
* Add testing
5 years ago
Wim bfa9a83d31
Refactor telegram (#649)
* Decrease complexity in Send() (makes codeclimate happy)
6 years ago
Wim 7923cfe8f8 Fix telegram crash #620 6 years ago
Wim 25cd1e2cc1
Refactor telegram handlers. Fix linting (#609)
* Refactor telegram handlers. Fix linting
6 years ago
Duco van Amstel ce21ba1545 Fix golint linter issues and enable it in CI (#593) 6 years ago
Wim b2a07aba3a Make goconst linter happy 6 years ago
Wim 399789811e Make gocritic linter happy 6 years ago
Wim 588b8e0303 Make interfacer linter happy 6 years ago
David Hill 0e2522279e Clean up various stuff (#508)
* various cleanups
6 years ago
Duco van Amstel f2cdda7278 Update Blackfriday dependency (closes #522) (#532)
- Fixup Telegram bridge implementation to support updated dependency.
6 years ago
Wim 221a63d980 Fix build (telegram) 6 years ago
Wim d02eda147c Add support for MessageFormat=htmlnick (telegram). #444 6 years ago
Liam Stanley 51327a4056 Reconnect on quit. (irc) See #431 (#445)
* potential fixes for #431
* go: fix formatting/gofmt/goreturns
6 years ago
Wim 406a54b597 Add QuoteFormat option (telegram). Closes #413 6 years ago
Wim ee4ac67081 Fix possible nil when using channels (telegram). #410 6 years ago
Wim b24a47ad7f Handle channel posts correctly (telegram) 6 years ago
Wim cd1fd1bb7c Fix panic (telegram). Closes #410 6 years ago
Wim a83831e68d Remove empty newlines from messages (telegram) #399 6 years ago
Wim e57f3a7e6c Add QuoteDisable option (telegram). Closes #399 6 years ago
Wim 7c4334d0de Remove unused import 6 years ago
Wim 062be8d7c9 Revert #378 6 years ago
Wim 1ec324354b Fix empty messages (telegram) 6 years ago
Wim f2f1d874e1 Use viper (github.com/spf13/viper) for configuration 6 years ago
Wim dbf8a326d5 Escape html on username (telegram). Closes #378 6 years ago
Wim 594d2155e3 Improve debug messages 6 years ago
Wim 2bac867382 Refactor using factory 6 years ago
Wim ad6440b603 Refactor telegram 6 years ago
Wim bab308508e Fix the UseInsecureURL text (telegram). Closes #184 6 years ago
Wim d1227b5fc9 Use prefixed-formatter for better logging 6 years ago
Wim 6ea368c383 Move Sirupsen => sirupsen 6 years ago
Wim a2b94452db Add more debug (telegram) 6 years ago
Wim 7886f05e88 Download (and upload) avatar images from mattermost and telegram when mediaserver is configured. Closes #362
An extra avatarMap (cache) is created for mattermost and telegram.
If MediaServerUpload is configured, the avatar images of users are downloaded the first time a
user sends a message.
If this download succeeds a message with EVENT_AVATAR_DOWNLOAD is sent to the originating protocol.
This message also contains a SHA field (in msg.Extra["file"]), if this is not empty, the sha will
be added to the avatarMap. (so we now have a userid-sha cache)

Next time this user sends a message, the MediaServerUpload/sha/userid.png URL will be used as the
avatar field.
6 years ago
Wim df5bce27b0 Fix panic on nil messages (telegram). Closes #366 6 years ago
Wim 432cd0f99d Add more parsemode debug (telegram) 6 years ago
Wim d4a47671ea Add markdown support (telegram). #355 6 years ago
Wim 80822b7fff Send chat notification if media is too big to be re-uploaded to MediaServer. See #359 6 years ago
Wim 7764493298 Add comment to file upload from telegram. Show comments on all bridges. Closes #358 7 years ago