add ONLY_MATCH_EMAIL boolean flag
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		
							
								
								
									
										32
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								main.go
									
									
									
									
									
								
							| @@ -77,6 +77,11 @@ func main() { | ||||
| 			Usage:  "enable debug message", | ||||
| 			EnvVar: "PLUGIN_DEBUG", | ||||
| 		}, | ||||
| 		cli.BoolFlag{ | ||||
| 			Name:   "match.email", | ||||
| 			Usage:  "send message when only match email", | ||||
| 			EnvVar: "PLUGIN_ONLY_MATCH_EMAIL", | ||||
| 		}, | ||||
| 		cli.StringFlag{ | ||||
| 			Name:   "format", | ||||
| 			Value:  "markdown", | ||||
| @@ -175,19 +180,20 @@ func run(c *cli.Context) error { | ||||
| 			Finished: c.Float64("job.finished"), | ||||
| 		}, | ||||
| 		Config: Config{ | ||||
| 			Token:    c.String("token"), | ||||
| 			Debug:    c.Bool("debug"), | ||||
| 			To:       c.StringSlice("to"), | ||||
| 			Message:  c.StringSlice("message"), | ||||
| 			Photo:    c.StringSlice("photo"), | ||||
| 			Document: c.StringSlice("document"), | ||||
| 			Sticker:  c.StringSlice("sticker"), | ||||
| 			Audio:    c.StringSlice("audio"), | ||||
| 			Voice:    c.StringSlice("voice"), | ||||
| 			Location: c.StringSlice("location"), | ||||
| 			Video:    c.StringSlice("video"), | ||||
| 			Venue:    c.StringSlice("venue"), | ||||
| 			Format:   c.String("format"), | ||||
| 			Token:      c.String("token"), | ||||
| 			Debug:      c.Bool("debug"), | ||||
| 			MatchEmail: c.Bool("match.email"), | ||||
| 			To:         c.StringSlice("to"), | ||||
| 			Message:    c.StringSlice("message"), | ||||
| 			Photo:      c.StringSlice("photo"), | ||||
| 			Document:   c.StringSlice("document"), | ||||
| 			Sticker:    c.StringSlice("sticker"), | ||||
| 			Audio:      c.StringSlice("audio"), | ||||
| 			Voice:      c.StringSlice("voice"), | ||||
| 			Location:   c.StringSlice("location"), | ||||
| 			Video:      c.StringSlice("video"), | ||||
| 			Venue:      c.StringSlice("venue"), | ||||
| 			Format:     c.String("format"), | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										27
									
								
								plugin.go
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								plugin.go
									
									
									
									
									
								
							| @@ -36,19 +36,20 @@ type ( | ||||
|  | ||||
| 	// Config for the plugin. | ||||
| 	Config struct { | ||||
| 		Token    string | ||||
| 		Debug    bool | ||||
| 		To       []string | ||||
| 		Message  []string | ||||
| 		Photo    []string | ||||
| 		Document []string | ||||
| 		Sticker  []string | ||||
| 		Audio    []string | ||||
| 		Voice    []string | ||||
| 		Location []string | ||||
| 		Video    []string | ||||
| 		Venue    []string | ||||
| 		Format   string | ||||
| 		Token      string | ||||
| 		Debug      bool | ||||
| 		MatchEmail bool | ||||
| 		To         []string | ||||
| 		Message    []string | ||||
| 		Photo      []string | ||||
| 		Document   []string | ||||
| 		Sticker    []string | ||||
| 		Audio      []string | ||||
| 		Voice      []string | ||||
| 		Location   []string | ||||
| 		Video      []string | ||||
| 		Venue      []string | ||||
| 		Format     string | ||||
| 	} | ||||
|  | ||||
| 	// Plugin values. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user