From ebaf1ce91f9a7487ad7b3179af257e9a963b2d44 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 24 Feb 2019 09:24:49 +0800 Subject: [PATCH] refactor: color --- plugin.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/plugin.go b/plugin.go index 2d9c5ea..8c2711b 100644 --- a/plugin.go +++ b/plugin.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "log" "net/http" "strconv" "strings" @@ -115,9 +114,7 @@ type ( // Exec executes the plugin. func (p *Plugin) Exec() error { - if len(p.Config.WebhookID) == 0 || len(p.Config.WebhookToken) == 0 { - log.Println("missing discord config") - + if p.Config.WebhookID == "" || p.Config.WebhookToken == "" { return errors.New("missing discord config") } @@ -229,13 +226,13 @@ func (p *Plugin) Color() int { switch p.Build.Status { case "success": - // #1ac600 green - return 1754624 + // green + return 0x1ac600 case "failure", "error", "killed": - // #ff3232 red - return 16724530 + // red + return 0xff3232 default: - // #ffd930 yellow - return 16767280 + // yellow + return 0xffd930 } }