Fixed edits not working on the oldest message
This commit is contained in:
parent
da0bda1270
commit
b37eee0bea
|
@ -254,8 +254,8 @@ func (ch *Channel) randomOldMsg() Message {
|
||||||
ch.messageMutex.Lock()
|
ch.messageMutex.Lock()
|
||||||
defer ch.messageMutex.Unlock()
|
defer ch.messageMutex.Unlock()
|
||||||
|
|
||||||
// Pick a random number, clamped to 10 and len channel.
|
// Pick a random index from last, clamped to 10 and len channel.
|
||||||
n := rand.Intn(len(ch.messageids)) % 10
|
n := len(ch.messageids) - rand.Intn(len(ch.messageids))%10
|
||||||
return ch.messages[ch.messageids[n]]
|
return ch.messages[ch.messageids[n]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue