Skip to content

Commit

Permalink
add DisableWebPagePreview feature to Telegram provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Delacour committed Nov 15, 2021
1 parent 8037a9e commit 18cb0bf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions provider/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down

0 comments on commit 18cb0bf

Please sign in to comment.