implemented delete favs (likes), and organized better code in files

This commit is contained in:
arnaucode
2017-04-30 18:25:47 +02:00
parent 49e293d300
commit 9834404c05
8 changed files with 156 additions and 54 deletions

View File

@@ -10,32 +10,6 @@ import (
"github.com/dghubble/go-twitter/twitter"
)
func getUserData(client *twitter.Client) *twitter.User {
// Verify Credentials
verifyParams := &twitter.AccountVerifyParams{
SkipStatus: twitter.Bool(true),
IncludeEmail: twitter.Bool(true),
}
user, _, _ := client.Accounts.VerifyCredentials(verifyParams)
return user
}
func printUserData(user *twitter.User) {
fmt.Print("username: ")
c.Cyan(user.Name + " @" + user.ScreenName)
if user.Email != "" {
fmt.Print("Email ")
c.Red(user.Email)
}
if user.Location != "" {
fmt.Print("Location: ")
c.Red(user.Location)
}
fmt.Print("user created on: ")
c.Cyan(user.CreatedAt)
fmt.Print("number of tweets: ")
c.Purple(strconv.Itoa(user.StatusesCount))
}
func deleteTweets(client *twitter.Client, user *twitter.User) {
tweets := getTweets(client, user.ScreenName, iterationsCount)
count := 0
@@ -52,7 +26,7 @@ func optionDeleteTweets(client *twitter.Client) {
user := getUserData(client)
printUserData(user)
fmt.Println("")
c.Red("Are you sure you want to delete you tweets? [y/n]")
c.Red("Are you sure you want to delete your tweets? [y/n]")
newcommand := bufio.NewReader(os.Stdin)
answer, _ := newcommand.ReadString('\n')
answer = strings.TrimSpace(answer)