diff --git a/mods/talk.go b/mods/talk.go index 5b2b910..f6208c6 100644 --- a/mods/talk.go +++ b/mods/talk.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + "io/ioutil" "log" "net/http" "strconv" @@ -54,6 +55,13 @@ type QResponse struct { const talkBaseURL = "https://api.api.ai/v1" func inittalk() { + if strings.HasPrefix(*talktoken, "@") { + data, err := ioutil.ReadFile((*talktoken)[1:]) + if err != nil { + panic(err) + } + *talktoken = string(data) + } if *talktoken == "" { panic(fmt.Errorf("API token for api.ai must be provided! (provide it or --disable talk)")) }