remove require owner adapter in favor of builtin adapter
This commit is contained in:
24
adapters.go
24
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user