commit 7d3bae69890d1d17deb4e8bb063ba730a480a054
parent cef891c1a776c32942082b925df7641271b79a0e
Author: Emile 'iMil' Heitor <imil@NetBSD.org>
Date: Fri, 14 Jul 2023 08:46:37 +0200
feat: can now reply privately
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
@@ -58,7 +58,7 @@ $ ./Gruik
For everybody:
-* `!lsfeeds` lists available RSS feeds
+* `!lsfeeds` lists available RSS feeds, can be asked privately
For ops:
diff --git a/main.go b/main.go
@@ -223,6 +223,11 @@ func main() {
c.Cmd.Join(channel)
})
client.Handlers.Add(girc.PRIVMSG, func(c *girc.Client, e girc.Event) {
+ dest := channel
+
+ if len(e.Params) > 0 && e.Params[0] != channel {
+ dest = e.Source.Name
+ }
if strings.HasPrefix(e.Last(), "!die") {
if isOp(e.Source.Name) {
c.Close()
@@ -231,7 +236,7 @@ func main() {
if strings.HasPrefix(e.Last(), "!lsfeeds") {
for i, f := range viper.GetStringSlice("feeds.urls") {
n := strconv.Itoa(i + 1)
- c.Cmd.Message(channel, n+". "+f)
+ c.Cmd.Message(dest, n+". "+f)
time.Sleep(viper.GetDuration("irc.delay"))
}
}