[core] Fix: Accept 1s cooldown, fix user and channel cooldowns

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-03-12 01:28:20 +01:00
parent 6ce8375fa5
commit 58b2f17885
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -277,7 +277,9 @@ func (c *configFile) fixDurations() {
// Fix rules
for _, r := range c.Rules {
r.ChannelCooldown = c.fixedDurationPtr(r.ChannelCooldown)
r.Cooldown = c.fixedDurationPtr(r.Cooldown)
r.UserCooldown = c.fixedDurationPtr(r.UserCooldown)
}
}
@ -289,7 +291,7 @@ func (configFile) fixedDuration(d time.Duration) time.Duration {
}
func (configFile) fixedDurationPtr(d *time.Duration) *time.Duration {
if d == nil || *d > time.Second {
if d == nil || *d >= time.Second {
return d
}
fd := *d * time.Second