Commit Graph

118 Commits (master)

Author SHA1 Message Date
Joseph Mansy 574f25337d
Add nil check for group update (telegram) (#2036) 1 year ago
Joseph Mansy 5bbe422161
Support telegram chat Join/Leave updates (#2019)
Co-authored-by: Wim <wim@42.be>
1 year ago
Thom Dickson 5feafcddba
Fix broken reply (telegram) (#2026)
Fixes #2021 

* Fix broken reply

* Fix reply/quoting logic with topics

* Update handlers.go

---------

Co-authored-by: Wim <wim@42.be>
1 year ago
Thom Dickson 601f48a50e
Add support for Telegram topics (telegram) (#1942)
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"
```
1 year ago
Joseph Mansy 768fb791c5
Use AuthorSignature as a fallback username (telegram) (#1979)
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 "".
1 year ago
Alexander 9bbdf70e69
Fix telegram attachment comment formatting and escaping (#1920) 2 years ago
Alexander 365acc36ea
Fix error messages in telegram and slack bridges (#1862)
* Fix message html entities escaping when sending to Telegram

* Fix error messages in telegram and slack bridges

Co-authored-by: Wim <wim@42.be>
2 years ago
Alexander 3c4192ebf6
Fix message html entities escaping when sending to Telegram (#1855) 2 years ago
Alexander 99fbd9cae6
Fix telegram message deletion request (#1818) 2 years ago
ValdikSS ce18c948e6
Do not apply any markup to URL entities (telegram) (#1808)
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.
2 years ago
Wim 7bc93c5506
Do not modify .webm files (telegram). Fixes #17** (#1802) 2 years ago
Alexander 30aae8e257
Multiple media in one message (telegram) (#1779)
* 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
2 years ago
Alexander 5d9604cd15
Preserve threading from telegram replies (telegram) (#1776)
* Preserve threading from telegram replies

* Add fallback for unthreaded telegram message

* Fix linter issue
2 years ago
Alexander cc36ebf1c9
Add UseFullName option (telegram) (#1777) 2 years ago
ValdikSS c51753cab1
Fix for complex-formatted Telegram text (#1765)
* 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
2 years ago
ValdikSS 9c203327c0
Fix Telegram channel title in forwards (#1753)
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".
2 years ago
Jan Martin Reckel ccb5b1d075
Fix Telegram Problem (unforwarded formatting and skipping of linebreaks) (#1749)
* 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>
2 years ago
Wim 4b226a6a63
Add support for sender_chat (telegram) (#1677)
* Add support for sender_chat (telegram)

Fixes #1654
https://core.telegram.org/bots/api#december-7-2021

* Add debuglevel option

Add `debuglevel=1` in telegram config to increase debug
2 years ago
Ivan Zuev 4801850013
Add Telegram Bot Command /chatId (telegram) (#1703)
* feat(telegram): command to get chat id

* Gofumpt

Co-authored-by: Ivan Zuev <i-zuev@yandex-team.ru>
Co-authored-by: Wim <wim@42.be>
2 years ago
Wim 02e3d7852b
Update telegram-bot-api to v5 (#1660) 3 years ago
Wim 658bdd9faa
Fix telegram/handlers.go linting (#1658) 3 years ago
Dan Walmsley b275efaeff
Add support for code blocks in telegram (#1650)
* 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.
3 years ago
Benau 53cafa9f3d
Convert .tgs with go libraries (and cgo) (telegram) (#1569)
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>
3 years ago
Paul b293e3fa75
Adding caption to send telegram images. Fixes #1357 (#1358)
* Used tgbotapi caption option to attach caption to photos / documents

* remove "text/template/parse"

* added TGGetParseMode to clean up. Added tg upload function for video, audio and voice

* fixed varname Textout. Changed fileextension logic to avoid chaining regex

* fixed textout varname

* fixed parsemode varname

* gofmt

Co-authored-by: Wim <wim@42.be>
3 years ago
Wim be3dfb251d
Check rune length instead of bytes (telegram). Fixes #1409 (#1412) 3 years ago
Paul b039da1eba
Add jpe as valid image filename extension (telegram) (#1360) 3 years ago
Wim 16fde6935c
Rename .oga audio files to .ogg (telegram) (#1349) 3 years ago
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>
4 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