Topics are surfaced by appending /<topic-id> to the channel setting for the gateway.
An example for the topic with ID of 16 would be:
```
[[gateway.inout]]
account="telegram.mytelegram"
channel="-100xxxxxxxxxx/16"
```
This comes in handy for annoucement type channels where neither the SenderChat or From structs contain name information.
Also Tweak username logic as when using a full name the username field can be " " instead of "".
handleEntities code uses simple modification offset which does not
allow to detect whether the offset is placed before or after
the element in already modified string.
This works fine is most cases as Telegram server always sort the
elements by offset, in ascending order.
However, this is not the case when the modification, for example bold
text, is applied to the URL. In this case, the offset of URL and
bold entity is equal, which raises the issue.
This commit introduces additional hack for this case, stripping
any entities which intersect with URL.
* Send multiple images/video/documents as media group
* Fix media caption quotting
* Fix errors handling
* Refactor parent id detection
* Try to reduce cognitive complexity of code
* Remove unused conditional
* Telegram: handle entities before everything
* Telegram: use runes for text entities
* Telegram: use proper offset and runes for links
* Telegram: put newline after backticks for pre
* Telegram: use utf16 for entity processing
Forward from channels requires different handling than forward from the regular users.
This patch fixes the issue: it prints channel title instead of "forwarded from unknown".
* Change bridge/telegram/handlers.go
Comment out the removing of empty lines
add support for bold, italic and striked telegram messages
* Implement Telegram MessageEntities correctly
* Apply gofmt
Co-authored-by: Jan Martin Reckel <jan-martin.reckel@s2017.tu-chemnitz.de>
Co-authored-by: Wim <wim@42.be>
* handle code blocks in telegram.
* support multi-line code blocks.
* remove import.
* handle code blocks in middle of normal text.
* support multiple code blocks in same message.
This commit adds support for go/cgo tgs conversion when building with the -tags `cgo`
The default binaries are still "pure" go and uses the old way of converting.
* Move lottie_convert.py conversion code to its own file
* Add optional libtgsconverter
* Update vendor
* Apply suggestions from code review
* Update bridge/helper/libtgsconverter.go
Co-authored-by: Wim <wim@42.be>
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.
* 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