Skip to content

Commit

Permalink
fix(discord): prevent bot from responding to self
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3r committed Apr 8, 2021
1 parent 663d416 commit 4389ed0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions remote/discord/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.R
}

bot.Name = botuser.Username
bot.ID = botuser.ID

foundGuild := false

Expand Down Expand Up @@ -177,6 +178,11 @@ func handleDiscordMessage(bot *models.Bot, inputMsgs chan<- models.Message) inte
return
}

// ignore messages from self
if m.Author.ID == bot.ID {
return
}

// Process message
message := models.NewMessage()
switch m.Type {
Expand Down

0 comments on commit 4389ed0

Please sign in to comment.