commit 4b649632a89b38851dcb256c3537bcb593fa339a
parent a9366d7cc0e190ff9bfc97f34570ce0a16a1c7ec
Author: Sébastien Marie <semarie@online.fr>
Date: Tue, 18 Jul 2023 09:09:47 +0000
systematically use irc.delay when using client.Cmd.Message()
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/main.go b/main.go
@@ -141,7 +141,6 @@ func newsFetch(client *girc.Client, channel string) {
}
client.Cmd.Message(channel, girc.Fmt(fmtNews(news)))
-
time.Sleep(viper.GetDuration("irc.delay"))
// Mark item as posted
@@ -285,6 +284,7 @@ func main() {
if news := getNewsByHash(s); news.Hash != "" {
post := fmt.Sprintf(" {r}(from %s on %s)", e.Source.Name, channel)
c.Cmd.Message(xchan, girc.Fmt(fmtNews(news)+post))
+ time.Sleep(viper.GetDuration("irc.delay"))
}
}
}
@@ -292,17 +292,20 @@ func main() {
numNews := len(newsList)
if numNews < 1 {
c.Cmd.Message(dest, "no news available")
+ time.Sleep(viper.GetDuration("irc.delay"))
return
}
p := strings.SplitN(e.Last(), " ", 3)
if len(p) < 2 {
c.Cmd.Message(dest, "usage: !latest <number> [origin]")
+ time.Sleep(viper.GetDuration("irc.delay"))
return
}
// n == number of news to show
n, err := strconv.Atoi(p[1])
if err != nil {
c.Cmd.Message(dest, "conversion error")
+ time.Sleep(viper.GetDuration("irc.delay"))
return
}
showNews := newsList