Fixed edits not working on the oldest message

This commit is contained in:
diamondburned (Forefront) 2020-06-12 17:26:11 -07:00
parent da0bda1270
commit b37eee0bea
1 changed files with 2 additions and 2 deletions

View File

@ -254,8 +254,8 @@ func (ch *Channel) randomOldMsg() Message {
ch.messageMutex.Lock()
defer ch.messageMutex.Unlock()
// Pick a random number, clamped to 10 and len channel.
n := rand.Intn(len(ch.messageids)) % 10
// Pick a random index from last, clamped to 10 and len channel.
n := len(ch.messageids) - rand.Intn(len(ch.messageids))%10
return ch.messages[ch.messageids[n]]
}