From 725bb9b81adfba244fd17d40ca15083cb1880d62 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 20 Oct 2018 16:51:18 -0500 Subject: [PATCH] Don't respond to mentions from bots. Requires mattn/go-mastodon#79. --- go.mod | 2 ++ go.sum | 4 ++-- main.go | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 4cd84c5..63d47e8 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/lynnesbian/mstdn-ebooks +replace github.com/mattn/go-mastodon => github.com/BenLubar-PR/go-mastodon v0.0.3-0.20181020214714-b83071c1d6fe // indirect + require ( github.com/gorilla/websocket v1.4.0 // indirect github.com/mattn/go-mastodon v0.0.3-0.20180129050910-2ccbcfe14d7a diff --git a/go.sum b/go.sum index d56bf02..c6af1e4 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ +github.com/BenLubar-PR/go-mastodon v0.0.3-0.20181020214714-b83071c1d6fe h1:QHvU/GniPgBLnR+unZL2uQCJFJim2k+khiq5tDARJd8= +github.com/BenLubar-PR/go-mastodon v0.0.3-0.20181020214714-b83071c1d6fe/go.mod h1:FSdXZyYNF22wiS4coSWuDdmJwZIUbLeyoLoUxrTFvXQ= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/mattn/go-mastodon v0.0.3-0.20180129050910-2ccbcfe14d7a h1:poZfGmljz6MxMXvFcYQvTx7TJQ2J9Gb+B2lgjOIPQnA= -github.com/mattn/go-mastodon v0.0.3-0.20180129050910-2ccbcfe14d7a/go.mod h1:/OSOSDJyV0OUlBuDV0Qrllizt3BJNj4Ir5xhckYRVmg= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFyPdL66DjUD96XmzVL3ZntbzcflLnznH0fr99w5VqE= golang.org/x/net v0.0.0-20181017193950-04a2e542c03f h1:4pRM7zYwpBjCnfA1jRmhItLxYJkaEnsmuAcRtA347DA= diff --git a/main.go b/main.go index 85c05a2..4bc55da 100644 --- a/main.go +++ b/main.go @@ -88,8 +88,7 @@ func main() { case *mastodon.DeleteEvent: // Ignore (for now) case *mastodon.NotificationEvent: - if e.Notification.Type != "mention" { - log.Printf("Ignoring notification of type %q", e.Notification.Type) + if e.Notification.Type != "mention" || e.Notification.Account.Bot { continue } _, err := client.PostStatus(ctx, genToot(ctx, me, e.Notification.Status))