Last active
December 4, 2016 22:53
-
-
Save fayimora/b5cde521695e9683e3580a4af4bb8cfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/dghubble/go-twitter/twitter" | |
"github.com/dghubble/oauth1" | |
) | |
func main() { | |
config := oauth1.NewConfig("---", "---") | |
token := oauth1.NewToken("---", "---") | |
httpClient := config.Client(oauth1.NoContext, token) | |
// Twitter client | |
client := twitter.NewClient(httpClient) | |
// Verify Client | |
verifyParams := &twitter.AccountVerifyParams{ | |
SkipStatus: twitter.Bool(true), | |
IncludeEmail: twitter.Bool(true), | |
} | |
// My User | |
user, _, _ := client.Accounts.VerifyCredentials(verifyParams) | |
fmt.Printf("My ACCOUNT:\n%+v\n", user) | |
// Followers | |
friends, _, _ := client.Friends.IDs(&twitter.FriendIDParams{}) | |
// followers, resp, err := client.Followers.List(&twitter.FollowerListParams{}) | |
for _, friendID := range friends.IDs { | |
userShowParams := &twitter.UserShowParams{UserID: friendID} | |
dmParams := &twitter.DirectMessageNewParams{UserID: friendID, Text: "Hello!"} | |
dm, _, err := client.DirectMessages.New(dmParams) | |
fmt.Println(dm) | |
fmt.Println("======================") | |
fmt.Println(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment