Writing A Twitter Bot in Golang
阿新 • • 發佈:2018-12-29
In this tutorial I’m going to be demonstrating how to build a twitter bot using go-twitter, a popular Go client library for the Twitter API.
I’ll be demonstrating how you can build a go based twitter bot that will be able to do such things as automatically reply to tweets and favourite tweets that contain a specific hashtag.
Connecting to Twitter
Just like with the Python version of this tutorial, you’ll have to create an app in twitter’s app control panel. Once you’ve created a new application, it should present you with all the secret tokens and keys that you need in order to proceed.
Writing our Basic Go Twitter Bot
Once you’ve got all the access tokens and secret tokens ready, it’s time to start implementing our Bot. Create a new file called twitter-bot.go and add the following:
|
|