change channel struct
This commit is contained in:
8
main.go
8
main.go
@@ -5,12 +5,14 @@ import (
|
||||
"os"
|
||||
"tweetdistributor/discord"
|
||||
"tweetdistributor/output"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
d := discord.Discord(os.Getenv("DISCORD_TOKEN"), os.Getenv("DISCORD_CHANNEL"))
|
||||
|
||||
tweetchannel := make(chan string, 1)
|
||||
tweetchannel := make(chan *discordgo.MessageCreate, 1)
|
||||
d.BeginRead(tweetchannel)
|
||||
|
||||
d.Write("Tweetdistributor Started")
|
||||
@@ -20,9 +22,9 @@ func main() {
|
||||
outputs = append(outputs, output.BlueskyOutput(os.Getenv("BSKY_IDENTIFIER"), os.Getenv("BSKY_PASSWORD")))
|
||||
|
||||
for tweet := range tweetchannel {
|
||||
fmt.Println(tweet)
|
||||
fmt.Println(tweet.Content)
|
||||
for _, output := range outputs {
|
||||
err := output.Write(tweet)
|
||||
err := output.Write(tweet.Content)
|
||||
if err != nil {
|
||||
errstr := fmt.Sprintf("%s Error: %s", output.GetName(), err)
|
||||
fmt.Fprintln(os.Stderr, errstr)
|
||||
|
||||
Reference in New Issue
Block a user