ignore message sent by bot self on slack channel

This commit is contained in:
2025-03-16 09:08:20 +09:00
parent c2e8c64262
commit 4aa04ce4d1
2 changed files with 3 additions and 1 deletions

View File

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

View File

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