commit abe13da2fe24b911f41623845eff9d81e9596fbb
parent 4e5cb61c1df4ec500d5d212bab92c5a4a7ab0f1a
Author: Sébastien Marie <semarie@online.fr>
Date: Tue, 18 Jul 2023 09:40:32 +0000
!rmfeed: use proper name for variable
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/main.go b/main.go
@@ -358,22 +358,22 @@ func main() {
}
}
if strings.HasPrefix(e.Last(), "!rmfeed") {
+ feeds := viper.GetStringSlice("feeds.urls")
s := getParam(e.Last())
if s == "" {
return
}
- ss := viper.GetStringSlice("feeds.urls")
i, err := strconv.Atoi(s)
if err != nil {
c.Cmd.ReplyTo(e, "index conversion failed")
return
}
- if i < 1 || i > len(ss) {
+ if i < 1 || i > len(feeds) {
c.Cmd.ReplyTo(e, "bad index number")
return
}
- ss = append(ss[:i-1], ss[i:]...)
- viper.Set("feeds.urls", ss)
+ feeds = append(feeds[:i-1], feeds[i:]...)
+ viper.Set("feeds.urls", feeds)
c.Cmd.ReplyTo(e, girc.Fmt("feed {b}{green}removed{c}{b}"))
if err := viper.WriteConfig(); err != nil {
c.Cmd.ReplyTo(e, girc.Fmt("removing feed {b}{red}failed{c}{b}"))