change channel struct

This commit is contained in:
2025-03-20 14:40:52 +09:00
parent d510488d3f
commit 5f9b838af5
2 changed files with 8 additions and 6 deletions

View File

@@ -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)