this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

progress on punching through labels

+20 -10
+2
cmd/automod/helpers.go
··· 23 23 } 24 24 25 25 // send label via engine 26 + c.Logger.Warn("adding label", "did", did, "label", label) 26 27 comment := "auto-adding label" 27 28 _, err := toolsozone.ModerationEmitEvent(c.Ctx, eng.OzoneClient, &toolsozone.ModerationEmitEvent_Input{ 28 29 CreatedBy: eng.OzoneClient.Auth.Did, ··· 63 64 } 64 65 65 66 // send label via engine 67 + c.Logger.Warn("removing label", "did", did, "label", label) 66 68 comment := "auto-removing label" 67 69 _, err := toolsozone.ModerationEmitEvent(c.Ctx, eng.OzoneClient, &toolsozone.ModerationEmitEvent_Input{ 68 70 CreatedBy: eng.OzoneClient.Auth.Did,
+18 -10
cmd/automod/rules.go
··· 31 31 return nil 32 32 } 33 33 34 - botDid := parentURI.Authority().String() 35 - authorDid := c.Account.Identity.DID.String() 34 + botDID, err := parentURI.Authority().AsDID() 35 + if err != nil { 36 + return err 37 + } 38 + authorDID := c.Account.Identity.DID 36 39 37 40 if botType == 1 { 38 - c.IncrementDistinct("goodbot", botDid, authorDid) 39 - c.IncrementDistinct("bladerunner", authorDid, botDid) 41 + c.IncrementDistinct("goodbot", botDID.String(), authorDID.String()) 42 + c.IncrementDistinct("bladerunner", authorDID.String(), botDID.String()) 40 43 c.Logger.Error("good bot reply") 41 44 42 - if c.GetCountDistinct("goodbot", botDid, countstore.PeriodTotal) > GOOD_BOT_REPLY_THRESHOLD-1 { 45 + // XXX: bypass counts for early testing 46 + if err = addAccountLabel(c, botDID, "good-bot"); err != nil { 47 + return err 48 + } 49 + 50 + if c.GetCountDistinct("goodbot", botDID.String(), countstore.PeriodTotal) > GOOD_BOT_REPLY_THRESHOLD-1 { 43 51 c.Logger.Error("good bot") 44 52 // c.AddAccountLabel("good-bot") 45 53 // c.Notify("slack") 46 54 } 47 55 48 - if c.GetCountDistinct("bladerunner", authorDid, countstore.PeriodTotal) > BLADERUNNER_THRESHOLD-1 { 56 + if c.GetCountDistinct("bladerunner", authorDID.String(), countstore.PeriodTotal) > BLADERUNNER_THRESHOLD-1 { 49 57 c.Logger.Error("bladerunner") 50 58 // c.AddAccountLabel("bladerunner") 51 59 // c.Notify("slack") ··· 54 62 return nil 55 63 } 56 64 57 - c.IncrementDistinct("badbot", botDid, authorDid) 58 - c.IncrementDistinct("jabroni", authorDid, botDid) 65 + c.IncrementDistinct("badbot", botDID.String(), authorDID.String()) 66 + c.IncrementDistinct("jabroni", authorDID.String(), botDID.String()) 59 67 c.Logger.Error("bad bot reply") 60 68 61 - if c.GetCountDistinct("badbot", botDid, countstore.PeriodTotal) > BAD_BOT_REPLY_THRESHOLD-1 { 69 + if c.GetCountDistinct("badbot", botDID.String(), countstore.PeriodTotal) > BAD_BOT_REPLY_THRESHOLD-1 { 62 70 // @TODO: this would add label to the reply author's account not the parent/bot's account 63 71 // c.AddAccountLabel("bad-bot") 64 72 c.Logger.Error("bad bot") 65 73 // c.Notify("slack") 66 74 } 67 75 68 - if c.GetCountDistinct("jabroni", authorDid, countstore.PeriodTotal) > JABRONI_THRESHOLD-1 { 76 + if c.GetCountDistinct("jabroni", authorDID.String(), countstore.PeriodTotal) > JABRONI_THRESHOLD-1 { 69 77 // c.AddAccountLabel("jabroni") 70 78 c.Logger.Error("jabroni") 71 79 // c.Notify("slack")