From 4aa04ce4d1f9f90fdf57a18707d35e3597f15ea2 Mon Sep 17 00:00:00 2001 From: sirrow Date: Sun, 16 Mar 2025 09:08:20 +0900 Subject: [PATCH] ignore message sent by bot self on slack channel --- discord/discordread.go | 2 +- main.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/discordread.go b/discord/discordread.go index 3e82e98..4c1faf0 100644 --- a/discord/discordread.go +++ b/discord/discordread.go @@ -30,7 +30,7 @@ func (d *discord) read(tweetchannel chan<- string) { } dgsession.AddHandler(func(s *discordgo.Session, m *discordgo.MessageCreate) { - if m.ChannelID == d.ChannelID { + if m.ChannelID == d.ChannelID && m.Author.ID != s.State.User.ID { tweetchannel <- m.Content } }) diff --git a/main.go b/main.go index 4057932..ce9ce85 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,8 @@ func main() { tweetchannel := make(chan string, 1) d.BeginRead(tweetchannel) + d.Write("Tweetdistributor Started") + 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")))