Files
tweetdistributor/main.go
2025-03-15 19:35:48 +09:00

28 lines
664 B
Go

package main
import (
"fmt"
"os"
"tweetdistributor/discord"
"tweetdistributor/output"
)
func main() {
fmt.Println("Hello, World!")
d := discord.Discord(os.Getenv("DISCORD_TOKEN"), os.Getenv("DISCORD_CHANNEL"))
tweetchannel := make(chan string, 1)
d.BeginRead(tweetchannel)
var outputs []output.OutputInterface
outputs = append(outputs, output.TwitterOutput(os.Getenv("TW_ACCESS_TOKEN"), os.Getenv("TW_ACCESS_SECRET")))
outputs = append(outputs, output.BlueskyOutput(os.Getenv("BSKY_IDENTIFIER"), os.Getenv("BSKY_PASSWORD")))
for tweet := range tweetchannel {
fmt.Println(tweet)
for _, output := range outputs {
output.Write(tweet)
}
}
}