mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2025-01-04 10:46:02 +00:00
Apply time-fix, json is not able to decode 2s
but 2
which is ns
instead of s Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
edd8a12af1
commit
6d358b307f
2 changed files with 12 additions and 1 deletions
|
@ -26,7 +26,7 @@ func (a ActorTimeout) Execute(c *irc.Client, m *irc.Message, r *Rule) error {
|
||||||
Command: "PRIVMSG",
|
Command: "PRIVMSG",
|
||||||
Params: []string{
|
Params: []string{
|
||||||
m.Params[0],
|
m.Params[0],
|
||||||
fmt.Sprintf("/timeout %s %d", m.User, *a.Timeout/time.Second),
|
fmt.Sprintf("/timeout %s %d", m.User, fixDurationValue(*a.Timeout)/time.Second),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
"sending timeout",
|
"sending timeout",
|
||||||
|
|
11
helpers.go
Normal file
11
helpers.go
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
func fixDurationValue(d time.Duration) time.Duration {
|
||||||
|
if d >= time.Second {
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
|
return d * time.Second
|
||||||
|
}
|
Loading…
Reference in a new issue