Browse Source

Merge pull request #160 from iopred/messagecount

Don't perform guild lookups if message tracking is not enabled.
Bruce 8 years ago
parent
commit
e325c8e9f9
1 changed files with 8 additions and 0 deletions
  1. 8 0
      state.go

+ 8 - 0
state.go

@@ -407,6 +407,10 @@ func (s *State) MessageAdd(message *Message) error {
 		return ErrNilState
 	}
 
+	if s.MaxMessageCount == 0 {
+		return nil
+	}
+
 	c, err := s.Channel(message.ChannelID)
 	if err != nil {
 		return err
@@ -437,6 +441,10 @@ func (s *State) MessageRemove(message *Message) error {
 		return ErrNilState
 	}
 
+	if s.MaxMessageCount == 0 {
+		return nil
+	}
+
 	c, err := s.Channel(message.ChannelID)
 	if err != nil {
 		return err