support markdown and html format.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
75c04eafaa
commit
2e602c4560
7
main.go
7
main.go
@ -37,6 +37,12 @@ func main() {
|
||||
Usage: "enable debug message",
|
||||
EnvVar: "PLUGIN_DEBUG",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "format",
|
||||
Value: "markdown",
|
||||
Usage: "telegram message format",
|
||||
EnvVar: "PLUGIN_FORMAT",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "repo.owner",
|
||||
Usage: "repository owner",
|
||||
@ -115,6 +121,7 @@ func run(c *cli.Context) error {
|
||||
Debug: c.Bool("debug"),
|
||||
To: c.StringSlice("to"),
|
||||
Message: c.StringSlice("message"),
|
||||
Format: c.String("format"),
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ type (
|
||||
Debug bool
|
||||
To []string
|
||||
Message []string
|
||||
Format string
|
||||
}
|
||||
|
||||
// Plugin values.
|
||||
@ -107,8 +108,9 @@ func (p Plugin) Exec() error {
|
||||
// send message.
|
||||
for _, user := range ids {
|
||||
for _, value := range trimElement(message) {
|
||||
log.Println(user)
|
||||
msg := tgbotapi.NewMessage(user, value)
|
||||
msg.ParseMode = "markdown"
|
||||
msg.ParseMode = p.Config.Format
|
||||
|
||||
_, err := bot.Send(msg)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user