go-mastodon/cmd/mstdn/cmd_followers.go
Yasuhiro Matsumoto 1ddd67b1a4 diaply acct instead of username
close #29
2017-04-19 20:52:14 +09:00

26 lines
535 B
Go

package main
import (
"context"
"fmt"
"github.com/mattn/go-mastodon"
"github.com/urfave/cli"
)
func cmdFollowers(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
account, err := client.GetAccountCurrentUser(context.Background())
if err != nil {
return err
}
followers, err := client.GetAccountFollowers(context.Background(), account.ID)
if err != nil {
return err
}
for _, follower := range followers {
fmt.Fprintf(c.App.Writer, "%v,%v\n", follower.ID, follower.Acct)
}
return nil
}