talonx / classicalbot

Home Page:https://twitter.com/classicaltrivia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Classical Music Trivia Bot

This Twitter bot tweets a classical music related titbit.

It can be deployed as a Google cloud function. The tweet is currently derived based on the day, and Twitter won't let you publish the same tweet again - so ensure that the periodicity is 24 hours at least if you are deploying on GCF.

Development

The bot uses Tweepy to interact with the Twitter API. Firebase is the data store, and you can use the Firebase emulator to try it locally.

Getting your credentials

Setup the following env vars. The first 2 you will get from your developer account. The last 2 from the output of twurl - usually stored in ~/.twurlrc

export CONSUMER_KEY=
export CONSUMER_SECRET=
export ACCESS_TOKEN=
export ACCESS_SECRET=

Loading the data in Firebase

Add a line to invoke the fuction write(db) inside the main.py and run

GOOGLE_APPLICATION_CREDENTIALS=key.json python3 main.py

where key.json is your GCP service account JSON key with permissions for writing to Firebase.

About

https://twitter.com/classicaltrivia

License:MIT License


Languages

Language:Python 100.0%