diff --git a/main.go b/main.go index 85a283b..59a962f 100644 --- a/main.go +++ b/main.go @@ -83,6 +83,11 @@ func main() { Usage: "send message when only match email", EnvVar: "PLUGIN_ONLY_MATCH_EMAIL", }, + cli.BoolTFlag{ + Name: "webpage.preview", + Usage: "toggle web-page preview", + EnvVar: "PLUGIN_WEBPAGE_PREVIEW", + }, cli.StringFlag{ Name: "format", Value: "markdown", @@ -205,6 +210,7 @@ func run(c *cli.Context) error { Token: c.String("token"), Debug: c.Bool("debug"), MatchEmail: c.Bool("match.email"), + WebPreview: c.Bool("webpage.preview"), To: c.StringSlice("to"), Message: c.StringSlice("message"), Photo: c.StringSlice("photo"), diff --git a/plugin.go b/plugin.go index 0600a68..ab0aad3 100644 --- a/plugin.go +++ b/plugin.go @@ -41,6 +41,7 @@ type ( Token string Debug bool MatchEmail bool + WebPreview bool To []string Message []string Photo []string @@ -260,6 +261,7 @@ func (p Plugin) Exec() error { msg := tgbotapi.NewMessage(user, txt) msg.ParseMode = p.Config.Format + msg.DisableWebPagePreview = !p.Config.WebPreview p.Send(bot, msg) }