42wim / matterbridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Apache License 2.0
6.64k stars 617 forks source link

Telegram: allow disabling link previews #980

Closed Mikaela closed 4 years ago

Mikaela commented 4 years ago

Is your feature request related to a problem? Please describe.

Link previews may contain unwanted material from other protocols or waste space in Telegram when there is a titlefetcher bot in the channel that repeats the messages (and shows another preview if the bot includes the domain).

Describe the solution you'd like

I wish to have the option of Matterbridge to not send link previews to Telegram as per bot API option disable_web_page_preview under sendMessage.

Describe alternatives you've considered

I don't know.

Additional context

I had a Discord spammer send a cock-and-ball-torture porn video on multiple channels that then appeared at Telegram and thankfully Matterbridge was able to remove those from there after they were removed from DIscord. While another moderator took care of it, I remembered the Telegram bot we used previously having a feature request to do just this https://github.com/FruitieX/teleirc/issues/140.

42wim commented 4 years ago

Ok, this is actually a pretty easy change, I'll add this later. You can build a binary yourself with this fix.

Just add in this file https://github.com/42wim/matterbridge/blob/master/bridge/telegram/telegram.go#L133-L134 after line 133

m.DisableWebPagePreview = true

and build.

Do your changes, download and install go from https://golang.org/dl/ and just do go build -mod vendor in the directory where you cloned matterbridge into.

42wim commented 4 years ago

Available in master now