Add feature to toggle web-page preview (#52)
This commit is contained in:
parent
eaeb3f678e
commit
709c4ce6a8
6
main.go
6
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"),
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user