Skip to content

Commit

Permalink
Ignore messages from other channels
Browse files Browse the repository at this point in the history
This will improve performance and also make it easier to debug.
  • Loading branch information
igolaizola committed Apr 24, 2023
1 parent 727df57 commit ea12bb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/ai/bluewillow/bluewillow.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func New(client *discord.Client, channelID string, debug bool) (ai.Client, error
if err := json.Unmarshal(e.RawData, &msg); err != nil {
log.Println("bluewillow: couldn't unmarshal message: %w", err)
}
// Ignore messages from other channels
if msg.ChannelID != c.channelID {
return
}
c.debugLog(e.Type, e.RawData)

var key search
Expand Down
4 changes: 4 additions & 0 deletions pkg/ai/midjourney/midjourney.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func New(client *discord.Client, channelID string, debug bool) (ai.Client, error
if err := json.Unmarshal(e.RawData, &msg); err != nil {
log.Println("midjourney: couldn't unmarshal message: %w", err)
}
// Ignore messages from other channels
if msg.ChannelID != c.channelID {
return
}
c.debugLog(e.Type, e.RawData)

var key search
Expand Down

0 comments on commit ea12bb4

Please sign in to comment.