diff --git a/internal/executor/add.go b/internal/executor/add.go index 25350dc..d48926b 100644 --- a/internal/executor/add.go +++ b/internal/executor/add.go @@ -105,7 +105,16 @@ func (a *AddExecutor) addAccountsToList(gtsClient *client.Client) error { for ind := range a.accountNames { accountID, err := getTheirAccountID(gtsClient, a.accountNames[ind]) if err != nil { - return fmt.Errorf("unable to get the account ID for %s, %w", a.accountNames[ind], err) + return fmt.Errorf("unable to get the account ID for %s: %w", a.accountNames[ind], err) + } + + relationship, err := gtsClient.GetAccountRelationship(accountID) + if err != nil { + return fmt.Errorf("unable to get your relationship to %s: %w", a.accountNames[ind], err) + } + + if !relationship.Following { + return NotFollowingError{Account: a.accountNames[ind]} } accountIDs[ind] = accountID diff --git a/internal/executor/errors.go b/internal/executor/errors.go index b001de7..3e5f571 100644 --- a/internal/executor/errors.go +++ b/internal/executor/errors.go @@ -94,3 +94,11 @@ func (e NoPollOptionError) Error() string { flagPollOption + " flag to add options to the poll" } + +type NotFollowingError struct { + Account string +} + +func (e NotFollowingError) Error() string { + return "you are not following " + e.Account +}