diff --git a/adapters.go b/adapters.go index f21f84d..8e3e387 100644 --- a/adapters.go +++ b/adapters.go @@ -36,27 +36,3 @@ func nsfwFilter() keybasebot.Adapter { } } } - -func requireOwner() keybasebot.Adapter { - return func(action keybasebot.BotAction) keybasebot.BotAction { - return func(m chat1.MsgSummary, b *keybasebot.Bot) (bool, error) { - b.Logger.Debug("checking owner command auth") - // if the team is in the allowed list, nsfw is allowed - data, ok := b.Meta["owner"] - if !ok { - b.Logger.Debug("unable to fetch owner from meta") - err := fmt.Errorf("owner command used without owner set") - return false, err - } - myOwner := data.(string) - if m.Sender.Username == myOwner { - b.Logger.Debug("owner command approved") - return action(m, b) - } - - // if the team is not allowed, fail silently - b.Logger.Info("@%s tried to user owner command without auth.", m.Sender.Username) - return true, nil - } - } -} diff --git a/main.go b/main.go index 7416f0d..34dd9fb 100644 --- a/main.go +++ b/main.go @@ -142,7 +142,7 @@ func run(c *cli.Context) error { setNsfw, keybasebot.MessageType("text"), keybasebot.CommandPrefix("!nsfw"), - requireOwner(), + keybasebot.FromUser(c.String("owner")), ), }, )