unfollow

package
v0.0.0-...-bcdd4fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2019 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:     "unfollow",
	Short:   "Start unfollowing a user",
	Example: "goinsta user unfollow robpike",
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			fmt.Println("Missing arguments. See example.")
			return
		}
		inst := utils.New()

		user, err := inst.Profiles.ByName(args[0])
		if err != nil {
			id, _ := strconv.ParseInt(args[0], 10, 64)
			user, err = inst.Profiles.ByID(id)
			if err != nil {
				fmt.Printf("Invalid username or id: %s\n", args[0])
				return
			}
		}
		user.FriendShip()

		if !user.Friendship.Following {
			fmt.Printf("You are currently unfollowing %s.\n", user.Username)
			return
		}

		err = user.Unfollow()
		if err != nil {
			fmt.Printf("error unfollowing %s: %s\n", user.Username, err)
			return
		}
		user.FriendShip()

		fmt.Printf("Following %s: %v\n", user.Username, user.Friendship.Following)
	},
}

RootCmd is used as a command line interaction with Instagram unfollow user method.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL