Mercurial > hg > Members > anatofuz > logroulette
changeset 6:2dbb638def9d
add y18
author | matac42 |
---|---|
date | Tue, 24 Nov 2020 20:19:10 +0900 |
parents | 269c2bf2cfce (current diff) d86513005167 (diff) |
children | 0d871c373996 |
files | members.json members.pl |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/run.go Tue Nov 24 20:18:04 2020 +0900 +++ b/run.go Tue Nov 24 20:19:10 2020 +0900 @@ -12,10 +12,14 @@ var iconURL string = "https://upload.wikimedia.org/wikipedia/commons/a/a4/13-02-27-spielbank-wiesbaden-by-RalfR-093.jpg" var botName string = "ログルーレット" -var webhook string = os.Getenv("MATTERMOST_WEBHOOK") +var webhook string func Run(jsonp string) int { + if webhook == "" { + os.Getenv("MATTERMOST_WEBHOOK") + } + users, err := convertFromJSonToUserInfo(jsonp) if err != nil { fmt.Println(err) @@ -26,8 +30,7 @@ fmt.Println(err) return 1 } - err = converUserInfoToJSON(newUsers, jsonp) - if err != nil { + if err := converUserInfoToJSON(newUsers, jsonp); err != nil { fmt.Println(err) return 1 } @@ -37,11 +40,13 @@ strBuilder.WriteString(targetUser) strBuilder.WriteString("さんです!! オナシャス!!") - slack.Send(webhook, &slack.Message{ + if err := slack.Send(webhook, &slack.Message{ Username: botName, Text: strBuilder.String(), IconURL: iconURL, - }) + }); err != nil { + fmt.Println(err) + } return 0 }