44 lines
877 B
Go
44 lines
877 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
fmt.Printf("Running...\n")
|
|
siteURL := os.Getenv("RDRAMA_URL")
|
|
if siteURL == "" {
|
|
log.Fatal("RDRAMA_URL environment variable not set")
|
|
}
|
|
|
|
siteToken := os.Getenv("RDRAMA_API_TOKEN")
|
|
if siteToken == "" {
|
|
log.Fatal("RDRAMA_API_TOKEN environment variable not set")
|
|
}
|
|
|
|
client := NewRDramaClient(siteURL, siteToken)
|
|
now := time.Now()
|
|
|
|
comments, err := client.GetComments(SearchParams{
|
|
Hole: "dankchristianmemes",
|
|
After: time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC),
|
|
})
|
|
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
panic(err)
|
|
}
|
|
fmt.Printf("Found comments: %d\n", len(comments))
|
|
|
|
for _, comment := range comments {
|
|
// fmt.Printf("%s: %s\n", comment.Author, comment.Text)
|
|
_ = GetReferences(strings.ToUpper(comment.Text))
|
|
}
|
|
|
|
// Use the client to make API requests
|
|
}
|