Skip to content

talonx/classicalbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.