Last change to readmarkers caused channels with uninitialized cache to always be read
@@ -173,7 +173,9 @@ func HasBeenRead(channel *discordgo.Channel, lastMessageID string) bool {
return true
}
- if len(channel.Messages) == 0 || channel.Messages[len(channel.Messages)-1].Author.ID == state.User.ID {
+ // If there was no message, lastMessageID would've been empty, therefore
+ // this check only makes sense if the cache is filled aready.
+ if len(channel.Messages) > 0 && channel.Messages[len(channel.Messages)-1].Author.ID == state.User.ID {
return true
}
