How can I upload media using go-twitter bot?

Babr :

I'm new to go, and have made this simple bot using go-twitter package.

package main

import (
    "fmt"
    "github.com/dghubble/go-twitter/twitter"
    "github.com/dghubble/oauth1"
)

func main() {
    consumerKey := "SECRET"
    consumerSecret := "SECRET"
    accessToken := "SECRET"
    accessSecret := "SECRET"

    config := oauth1.NewConfig(consumerKey, consumerSecret)
    token := oauth1.NewToken(accessToken, accessSecret)

    // OAuth1 http.Client will automatically authorize Requests
    httpClient := config.Client(oauth1.NoContext, token)

    // Twitter client
    client := twitter.NewClient(httpClient)

    tweet, resp, err := client.Statuses.Update("Hi baby, I'm just a bot!", nil)
    if err != nil {
        fmt.Println(err)
    }

    fmt.Printf("TWEETED: %+v , %v\n", tweet.Text, resp)
}

I'm wondering how can I upload media using this bot?

I see there is a MediaIds in the source code, but have not clue how to use that and there is no explanation in the docs.

Зелёный :

There is no such functionality.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I upload a file to server, without browser, using go?

分類Dev

How can I keep my Twitter Bot awake with Rails?

分類Dev

How can I search users on Twitter using multiple filters?

分類Dev

How can I upload multiple files using JavaScript and FastAPI?

分類Dev

How can I upload a file using `curl` instead of the form?

分類Dev

How can you upload files as a stream in go?

分類Dev

How do I make a Discord bot using discord.py rewrite that can make bot users that are not real

分類Dev

How far back can you go back with the Twitter API

分類Dev

How can I display a div if a user is using a browser not supported by Twitter Bootstrap

分類Dev

How I can limit Download/Upload bandwidth?

分類Dev

How i can upload image to the article?

分類Dev

How can I upload to GitHub through Putty?

分類Dev

How can I upload a new revision to an specific file in Google Drive using the REST API?

分類Dev

how can i upload doc, pdf and txt file in ionic1 using cordova?

分類Dev

How do I upload an image using PHP?

分類Dev

How can I say "height < width" in a CSS media query?

分類Dev

How can I play FLAC audio files on Windows Media Player?

分類Dev

Go: How can I "unpack" a struct?

分類Dev

how can I debug go tests with gdb

分類Dev

How can I create a pair type in go?

分類Dev

How can I get master branch of a dependency when using Go modules

分類Dev

Using Glide, how can I go over each frame of GifDrawable, as Bitmap?

分類Dev

Using Glide, how can I go over each frame of GifDrawable, as Bitmap?

分類Dev

How can I go about creating a scrollable page content using arrow keys?

分類Dev

Azure Bot Service using over 1GB of data transfer out per day. Why? How can I stop that?

分類Dev

How can i save changed data from RecyclerView and upload the changes

分類Dev

How can I upload a file to a Visual Studio Codespaces environment?

分類Dev

How can I upload my videos to the recommended encoding settings for YouTube?

分類Dev

How can I make bots display the "Bot is typing ..." status?

Related 関連記事

  1. 1

    How can I upload a file to server, without browser, using go?

  2. 2

    How can I keep my Twitter Bot awake with Rails?

  3. 3

    How can I search users on Twitter using multiple filters?

  4. 4

    How can I upload multiple files using JavaScript and FastAPI?

  5. 5

    How can I upload a file using `curl` instead of the form?

  6. 6

    How can you upload files as a stream in go?

  7. 7

    How do I make a Discord bot using discord.py rewrite that can make bot users that are not real

  8. 8

    How far back can you go back with the Twitter API

  9. 9

    How can I display a div if a user is using a browser not supported by Twitter Bootstrap

  10. 10

    How I can limit Download/Upload bandwidth?

  11. 11

    How i can upload image to the article?

  12. 12

    How can I upload to GitHub through Putty?

  13. 13

    How can I upload a new revision to an specific file in Google Drive using the REST API?

  14. 14

    how can i upload doc, pdf and txt file in ionic1 using cordova?

  15. 15

    How do I upload an image using PHP?

  16. 16

    How can I say "height < width" in a CSS media query?

  17. 17

    How can I play FLAC audio files on Windows Media Player?

  18. 18

    Go: How can I "unpack" a struct?

  19. 19

    how can I debug go tests with gdb

  20. 20

    How can I create a pair type in go?

  21. 21

    How can I get master branch of a dependency when using Go modules

  22. 22

    Using Glide, how can I go over each frame of GifDrawable, as Bitmap?

  23. 23

    Using Glide, how can I go over each frame of GifDrawable, as Bitmap?

  24. 24

    How can I go about creating a scrollable page content using arrow keys?

  25. 25

    Azure Bot Service using over 1GB of data transfer out per day. Why? How can I stop that?

  26. 26

    How can i save changed data from RecyclerView and upload the changes

  27. 27

    How can I upload a file to a Visual Studio Codespaces environment?

  28. 28

    How can I upload my videos to the recommended encoding settings for YouTube?

  29. 29

    How can I make bots display the "Bot is typing ..." status?

ホットタグ

アーカイブ