Pas mal, non ? C'est français.
All checks were successful
ci / deploy (push) Successful in 39s
ci-build / build (1.24) (push) Successful in 9m37s

This commit is contained in:
2026-04-16 15:11:10 +02:00
parent 75cdff5011
commit 6b5b8f4d43
3 changed files with 298 additions and 290 deletions

View File

@@ -27,4 +27,4 @@ jobs:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
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
View File

@@ -22,7 +22,7 @@ const (
type Quote struct {
Quote string `json:"quote"`
Page string `json:"page"`
ThumbURL string `json:"thumb_url"`
Thumb string `json:"thumb"`
}
// 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() {
args := os.Args
@@ -89,7 +97,7 @@ func main() {
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
@@ -102,7 +110,7 @@ func main() {
results := make(tb.Results, len(quotes))
for i, quote := range quotes {
url := quote.VideoURL()
thumb := quote.ThumbURL
thumb := quote.ThumbURL()
log.Printf("{%s, %s}\n", url, thumb)
results[i] = &tb.VideoResult{
URL: url,
@@ -153,7 +161,7 @@ func Update() error {
videos,
Quote{
Quote: e.ChildAttr("img", "alt"),
ThumbURL: e.ChildAttr("img", "data-original"),
Thumb: e.ChildAttr("img", "data-original"),
Page: e.ChildAttr("a", "href"),
},
)

File diff suppressed because it is too large Load Diff