Pas mal, non ? C'est français.
This commit is contained in:
@@ -27,4 +27,4 @@ jobs:
|
|||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
script: echo ${{ secrets.PASSWORD }} | sudo -S systemctl restart alfred-bot
|
script: echo ${{ secrets.PASSWORD }} | sudo -S systemctl restart abitbol-bot
|
||||||
|
|||||||
16
bot.go
16
bot.go
@@ -22,7 +22,7 @@ const (
|
|||||||
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"`
|
Thumb string `json:"thumb"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VideoURL get url of the video
|
// VideoURL get url of the video
|
||||||
@@ -33,6 +33,14 @@ func (q *Quote) VideoURL() string {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ThumbURL get url of the video
|
||||||
|
func (q *Quote) ThumbURL() string {
|
||||||
|
return fmt.Sprintf(
|
||||||
|
"https://george-abitbol.fr/%s",
|
||||||
|
q.Thumb,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
args := os.Args
|
args := os.Args
|
||||||
|
|
||||||
@@ -89,7 +97,7 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
b.Send(m.Chat, fmt.Sprintf("%s\n\n%s", quotes[0].Quote, quotes[0].VideoURL()))
|
b.Send(m.Chat, fmt.Sprintf("%s\n\n%s\n%s", quotes[0].Quote, quotes[0].VideoURL(), quotes[0].ThumbURL()))
|
||||||
})
|
})
|
||||||
|
|
||||||
// Search feature
|
// Search feature
|
||||||
@@ -102,7 +110,7 @@ func main() {
|
|||||||
results := make(tb.Results, len(quotes))
|
results := make(tb.Results, len(quotes))
|
||||||
for i, quote := range quotes {
|
for i, quote := range quotes {
|
||||||
url := quote.VideoURL()
|
url := quote.VideoURL()
|
||||||
thumb := quote.ThumbURL
|
thumb := quote.ThumbURL()
|
||||||
log.Printf("{%s, %s}\n", url, thumb)
|
log.Printf("{%s, %s}\n", url, thumb)
|
||||||
results[i] = &tb.VideoResult{
|
results[i] = &tb.VideoResult{
|
||||||
URL: url,
|
URL: url,
|
||||||
@@ -153,7 +161,7 @@ func Update() error {
|
|||||||
videos,
|
videos,
|
||||||
Quote{
|
Quote{
|
||||||
Quote: e.ChildAttr("img", "alt"),
|
Quote: e.ChildAttr("img", "alt"),
|
||||||
ThumbURL: e.ChildAttr("img", "data-original"),
|
Thumb: e.ChildAttr("img", "data-original"),
|
||||||
Page: e.ChildAttr("a", "href"),
|
Page: e.ChildAttr("a", "href"),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
570
quotes.json
570
quotes.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user