gruik

Fork of GCU-Squad's RSS-to-IRC bridge
git clone https://git.instinctive.eu/gruik.git
Log | Files | Refs | README | LICENSE

commit ceeb962d84ef5adb1a9c119c45df9d167dc07d4b
parent 06458d341c8463a0550f3358e4cd7a9c5ebca6fa
Author: Sébastien Marie <semarie@online.fr>
Date:   Tue, 18 Jul 2023 09:14:37 +0000

!latest: use proper name for variable

Diffstat:
Mmain.go | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/main.go b/main.go @@ -298,14 +298,14 @@ func main() { time.Sleep(viper.GetDuration("irc.delay")) return } - p := strings.SplitN(e.Last(), " ", 3) - if len(p) < 2 { + args := strings.SplitN(e.Last(), " ", 3) + if len(args) < 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]) + n, err := strconv.Atoi(args[1]) if err != nil { c.Cmd.Message(dest, "conversion error") time.Sleep(viper.GetDuration("irc.delay")) @@ -313,8 +313,8 @@ func main() { } showNews := newsList // there was a second parameter, specific origin - if len(p) > 2 { - showNews = getNewsByOrigin(p[2]) + if len(args) > 2 { + showNews = getNewsByOrigin(args[2]) numNews = len(showNews) } // user gave a greater number that we have news