mirror of
https://github.com/idanoo/NZCovidBot
synced 2025-07-02 19:52:14 +00:00
Pulls from git and posts to discord
This commit is contained in:
parent
d63f121871
commit
b37a425589
12 changed files with 611 additions and 5 deletions
37
cmd/nzcovidbot/main.go
Normal file
37
cmd/nzcovidbot/main.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.m2.nz/idanoo/nzcovidbot/internal/nzcovidbot"
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Println("Starting NZ Covid Bot")
|
||||
|
||||
// Load .env file
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
log.Fatal("Error loading .env file")
|
||||
}
|
||||
|
||||
// Fetch discord webhooks
|
||||
nzcovidbot.DiscordWebhooks = strings.Split(os.Getenv("DISCORD_WEBHOOKS"), ",")
|
||||
|
||||
// Fetch twitter keys
|
||||
nzcovidbot.TwitterCreds = nzcovidbot.TwitterCredentials{
|
||||
ConsumerKey: os.Getenv("TWITTER_CONSUMER_KEY"),
|
||||
ConsumerSecret: os.Getenv("TWITTER_CONSUMER_SECRET"),
|
||||
AccessToken: os.Getenv("TWITTER_ACCESS_TOKEN"),
|
||||
AccessTokenSecret: os.Getenv("TWITTER_ACCESS_TOKEN_SECRET"),
|
||||
}
|
||||
|
||||
// Git repo URL
|
||||
nzcovidbot.Repository = os.Getenv("SOURCE_REPO")
|
||||
|
||||
// Boot up listeners / main loop
|
||||
nzcovidbot.Lesgoooo()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue