Browse Source

Comments to show intended structure use

pull/159/head
Richard Lewis 8 years ago
parent
commit
ec97260b18
  1. 2
      src/github.com/matrix-org/go-neb/services/google/google.go
  2. 3
      src/github.com/matrix-org/go-neb/services/wikipedia/wikipedia.go

2
src/github.com/matrix-org/go-neb/services/google/google.go

@ -123,7 +123,7 @@ func (s *Service) cmdGoogleImgSearch(client *gomatrix.Client, roomID, userID str
// FIXME -- Sometimes upload fails with a cryptic error - "msg=Upload request failed code=400" // FIXME -- Sometimes upload fails with a cryptic error - "msg=Upload request failed code=400"
resUpload, err := client.UploadLink(imgURL) resUpload, err := client.UploadLink(imgURL)
if err != nil { if err != nil {
return nil, fmt.Errorf("Failed to upload Google image to matrix: %s", err.Error())
return nil, fmt.Errorf("Failed to upload Google image at URL %s (content type %s) to matrix: %s", imgURL, searchResult.Mime, err.Error())
} }
return gomatrix.ImageMessage{ return gomatrix.ImageMessage{

3
src/github.com/matrix-org/go-neb/services/wikipedia/wikipedia.go

@ -21,14 +21,17 @@ const maxExtractLength = 1024 // Max length of extract string in bytes
var httpClient = &http.Client{} var httpClient = &http.Client{}
// Search results (returned by search query)
type wikipediaSearchResults struct { type wikipediaSearchResults struct {
Query wikipediaQuery `json:"query"` Query wikipediaQuery `json:"query"`
} }
// Wikipeda pages returned in search results
type wikipediaQuery struct { type wikipediaQuery struct {
Pages map[string]wikipediaPage `json:"pages"` Pages map[string]wikipediaPage `json:"pages"`
} }
// Representation of an individual wikipedia page
type wikipediaPage struct { type wikipediaPage struct {
PageID int64 `json:"pageid"` PageID int64 `json:"pageid"`
NS int `json:"ns"` NS int `json:"ns"`

Loading…
Cancel
Save