ailistener

git clone git://archive.git.mtrnord.blog/OpenHomeAuto/ailistener.git
Log | Files | Refs | LICENSE

commit 26153b9a387c82c8c210d03c5a194b5712a8e909
parent 7a84620bdd295c2d4ba284a02cbdc957c32a54aa
Author: MTRNord <mtrnord1@gmail.com>
Date:   Thu, 28 Jun 2018 21:08:48 +0200

Fix loop

Diffstat:
M.idea/usage.statistics.xml | 8++++----
Mpkg/webhook/webhook.go | 24+++++++++++++++---------
2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/.idea/usage.statistics.xml b/.idea/usage.statistics.xml @@ -38,14 +38,14 @@ <session id="958628364"> <usages-collector id="statistics.file.extensions.edit"> <counts> - <entry key="go" value="252" /> - <entry key="txt" value="166" /> + <entry key="go" value="310" /> + <entry key="txt" value="192" /> </counts> </usages-collector> <usages-collector id="statistics.file.types.edit"> <counts> - <entry key="Go" value="252" /> - <entry key="PLAIN_TEXT" value="166" /> + <entry key="Go" value="310" /> + <entry key="PLAIN_TEXT" value="192" /> </counts> </usages-collector> <usages-collector id="statistics.file.extensions.open"> diff --git a/pkg/webhook/webhook.go b/pkg/webhook/webhook.go @@ -96,15 +96,21 @@ func MessagesEndPoint(rw http.ResponseWriter, req *http.Request) { rw.WriteHeader(http.StatusBadRequest) return }*/ + switch dfr.QueryResult.Action { + case "play_music": + log.Println(dfr.QueryResult) + + resp := dflow.DoSignIn() + // Do things with the context you just retrieved + dff := &df.Fulfillment{ + FollowupEventInput: resp, + } - log.Println(dfr.QueryResult) - - resp := dflow.DoSignIn() - // Do things with the context you just retrieved - dff := &df.Fulfillment{ - FollowupEventInput: resp, + rw.Header().Set("Content-Type", "application/json") + rw.WriteHeader(http.StatusOK) + json.NewEncoder(rw).Encode(dff) + default: + log.Println(dfr.QueryResult) } - rw.Header().Set("Content-Type", "application/json") - rw.WriteHeader(http.StatusOK) - json.NewEncoder(rw).Encode(dff) + }