Commit Graph

99 Commits

Author SHA1 Message Date
Wim
02e3d7852b
Update telegram-bot-api to v5 (#1660) 2021-12-12 00:35:32 +01:00
Wim
658bdd9faa
Fix telegram/handlers.go linting (#1658) 2021-12-10 22:13:54 +01:00
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.
2021-12-07 21:26:28 +01:00
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>
2021-08-24 22:32:50 +02:00
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>
2021-04-03 23:15:19 +02:00
Wim
be3dfb251d
Check rune length instead of bytes (telegram). Fixes #1409 (#1412) 2021-02-25 23:28:54 +01:00
Paul
b039da1eba
Add jpe as valid image filename extension (telegram) (#1360) 2021-01-14 23:42:13 +01:00
Wim
16fde6935c
Rename .oga audio files to .ogg (telegram) (#1349) 2021-01-02 00:55:20 +01:00
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.
2020-08-23 22:34:28 +02:00
Andrey Groshev
a94fe55886
Fix MarkdownV2 support in Telegram (#1169) 2020-07-12 22:40:22 +02:00
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.
2020-05-23 19:15:26 +02:00
Wim
e343db6f72
Make avatars download work with mediaserverdownload (telegram). Fixes #920 (#1012) 2020-02-15 18:31:40 +01:00
Wim
f8ad877601
Add DisableWebPagePreview option (telegram). Closes #980 (#994) 2020-02-02 18:53:04 +01:00
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
2020-01-30 00:02:33 +01:00
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>
2020-01-09 18:14:01 +01:00
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
2019-07-08 22:19:45 +02:00
Wim
01d0a9f412 Handle nil message (telegram). Fixes #777 2019-04-05 00:04:08 +02:00
Wim
8cc2d3b4fe Revert "Bail if any vars are nil, not if all (telegram) (#778)"
This reverts commit efd2c99862.
2019-04-05 00:02:26 +02:00
David Hill
efd2c99862 Bail if any vars are nil, not if all (telegram) (#778) 2019-03-27 21:00:57 +01:00
Wim
f57370f33a
Add support for URL in messageEntities (telegram). Fixes #735 (#736) 2019-03-02 22:38:44 +01:00
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
2019-02-27 00:41:50 +01:00
Wim
96841c70c7 Fix regression in HTML handling (telegram). Closes #734
* Revert back to blackfriday v1
* Add testing
2019-02-24 15:13:56 +01:00
Wim
bfa9a83d31
Refactor telegram (#649)
* Decrease complexity in Send() (makes codeclimate happy)
2018-12-12 23:50:08 +01:00
Wim
7923cfe8f8 Fix telegram crash #620 2018-11-29 23:03:50 +01:00
Wim
25cd1e2cc1
Refactor telegram handlers. Fix linting (#609)
* Refactor telegram handlers. Fix linting
2018-11-28 10:57:59 +01:00
Duco van Amstel
ce21ba1545 Fix golint linter issues and enable it in CI (#593) 2018-11-15 20:43:43 +01:00
Wim
b2a07aba3a Make goconst linter happy 2018-11-08 22:20:03 +01:00
Wim
399789811e Make gocritic linter happy 2018-11-08 00:46:34 +01:00
Wim
588b8e0303 Make interfacer linter happy 2018-11-08 00:35:30 +01:00
David Hill
0e2522279e Clean up various stuff (#508)
* various cleanups
2018-11-07 20:36:50 +01:00
Duco van Amstel
f2cdda7278 Update Blackfriday dependency (closes #522) (#532)
- Fixup Telegram bridge implementation to support updated dependency.
2018-10-22 19:48:29 +02:00
Wim
221a63d980 Fix build (telegram) 2018-06-18 23:49:28 +02:00
Wim
d02eda147c Add support for MessageFormat=htmlnick (telegram). #444 2018-06-18 23:38:52 +02:00
Liam Stanley
51327a4056 Reconnect on quit. (irc) See #431 (#445)
* potential fixes for #431
* go: fix formatting/gofmt/goreturns
2018-06-09 12:47:40 +02:00
Wim
406a54b597 Add QuoteFormat option (telegram). Closes #413 2018-05-11 20:59:15 +02:00
Wim
ee4ac67081 Fix possible nil when using channels (telegram). #410 2018-05-05 23:15:50 +02:00
Wim
b24a47ad7f Handle channel posts correctly (telegram) 2018-04-29 22:31:11 +02:00
Wim
cd1fd1bb7c Fix panic (telegram). Closes #410 2018-04-29 15:46:40 +02:00
Wim
a83831e68d Remove empty newlines from messages (telegram) #399 2018-04-19 12:53:49 +02:00
Wim
e57f3a7e6c Add QuoteDisable option (telegram). Closes #399 2018-04-17 23:26:41 +02:00
Wim
7c4334d0de Remove unused import 2018-03-17 22:54:54 +01:00
Wim
062be8d7c9 Revert #378 2018-03-17 18:02:00 +01:00
Wim
1ec324354b Fix empty messages (telegram) 2018-03-05 00:43:59 +01:00
Wim
f2f1d874e1 Use viper (github.com/spf13/viper) for configuration 2018-03-04 23:52:14 +01:00
Wim
dbf8a326d5 Escape html on username (telegram). Closes #378 2018-02-28 23:25:00 +01:00
Wim
594d2155e3 Improve debug messages 2018-02-28 22:23:29 +01:00
Wim
2bac867382 Refactor using factory 2018-02-27 23:22:12 +01:00
Wim
ad6440b603 Refactor telegram 2018-02-27 23:22:10 +01:00
Wim
bab308508e Fix the UseInsecureURL text (telegram). Closes #184 2018-02-21 13:30:38 +01:00
Wim
d1227b5fc9 Use prefixed-formatter for better logging 2018-02-21 00:20:25 +01:00