You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
677 B

7 years ago
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/dghubble/go-twitter/twitter"
  5. )
  6. func getUserData(client *twitter.Client) *twitter.User {
  7. // Verify Credentials
  8. verifyParams := &twitter.AccountVerifyParams{
  9. SkipStatus: twitter.Bool(true),
  10. IncludeEmail: twitter.Bool(true),
  11. }
  12. user, _, _ := client.Accounts.VerifyCredentials(verifyParams)
  13. return user
  14. }
  15. func printTwitterUserData(user *twitter.User) {
  16. fmt.Print("username: ")
  17. c.Cyan(user.Name + " @" + user.ScreenName)
  18. if user.Email != "" {
  19. fmt.Print("Email ")
  20. c.Red(user.Email)
  21. }
  22. if user.Location != "" {
  23. fmt.Print("Location: ")
  24. c.Red(user.Location)
  25. }
  26. fmt.Print("user created on: ")
  27. c.Cyan(user.CreatedAt)
  28. }