Format
This commit is contained in:
10
bot.go
10
bot.go
@@ -20,8 +20,8 @@ const (
|
|||||||
|
|
||||||
// Quote represent a quote of the flim
|
// Quote represent a quote of the flim
|
||||||
type Quote struct {
|
type Quote struct {
|
||||||
Quote string `json:"quote"`
|
Quote string `json:"quote"`
|
||||||
Page string `json:"page"`
|
Page string `json:"page"`
|
||||||
ThumbURL string `json:"thumb_url"`
|
ThumbURL string `json:"thumb_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ func main() {
|
|||||||
// Cite command
|
// Cite command
|
||||||
b.Handle("/cite", func(m *tb.Message) {
|
b.Handle("/cite", func(m *tb.Message) {
|
||||||
quotes, err := index.Search(m.Text)
|
quotes, err := index.Search(m.Text)
|
||||||
if err != nil || len(quotes) == 0{
|
if err != nil || len(quotes) == 0 {
|
||||||
b.Send(m.Chat, "Pas de citation trouvée")
|
b.Send(m.Chat, "Pas de citation trouvée")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -152,9 +152,9 @@ func Update() error {
|
|||||||
videos = append(
|
videos = append(
|
||||||
videos,
|
videos,
|
||||||
Quote{
|
Quote{
|
||||||
Quote: e.ChildAttr("img", "alt"),
|
Quote: e.ChildAttr("img", "alt"),
|
||||||
ThumbURL: e.ChildAttr("img", "data-original"),
|
ThumbURL: e.ChildAttr("img", "data-original"),
|
||||||
Page: e.ChildAttr("a", "href"),
|
Page: e.ChildAttr("a", "href"),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
4
index.go
4
index.go
@@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
// QuoteIndex index of quotes
|
// QuoteIndex index of quotes
|
||||||
type QuoteIndex struct {
|
type QuoteIndex struct {
|
||||||
index bleve.Index
|
index bleve.Index
|
||||||
Videos []Quote
|
Videos []Quote
|
||||||
videoByPage map[string]Quote //videoByPage[youtubeKey]
|
videoByPage map[string]Quote //videoByPage[youtubeKey]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user