From 18cb0bfac9be295f4d204545a155bb47e3acc34e Mon Sep 17 00:00:00 2001 From: Benjamin Delacour Date: Mon, 15 Nov 2021 11:03:20 +0100 Subject: [PATCH] add DisableWebPagePreview feature to Telegram provider --- provider/telegram/telegram.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/provider/telegram/telegram.go b/provider/telegram/telegram.go index cbf8b85..2d5ec59 100644 --- a/provider/telegram/telegram.go +++ b/provider/telegram/telegram.go @@ -7,13 +7,14 @@ import ( ) type Config struct { - Token string `yaml:"token"` - ParseMode string `yaml:"parse_mode"` + Token string `yaml:"token"` + ParseMode string `yaml:"parse_mode"` + DisableWebPagePreview bool `yaml:"disable_web_page_preview"` } type Telegram struct { - bot *tgbotapi.BotAPI - config *Config + bot *tgbotapi.BotAPI + config *Config } func NewTelegram(config Config) (*Telegram, error) { @@ -37,6 +38,7 @@ func (tg *Telegram) Send(message sachet.Message) error { msg := tgbotapi.NewMessage(chatID, message.Text) msg.ParseMode = tg.config.ParseMode + msg.DisableWebPagePreview = tg.config.DisableWebPagePreview _, err = tg.bot.Send(msg) if err != nil {