Sign inSign up

thzinc/bikesharesystem

By thzinc

Updated almost 9 years ago

Bike share system to power #BikeShareChallenge Twitter bots

Image
0

354

thzinc/bikesharesystem repository overview

Bike Share System

Powering the interactive #BikeShareChallenges for @BikeDTLABot and others

This is a program that uses the Twitter streaming API to receive Tweets and then reply to them with challenges.

@BikeDTLABot demo

Quickstart

Create a settings.json file with the configuration of the GBFS feed information and Twitter account information for the bots this will power.

Example settings.json
{
    "bike_share_systems": [
        {
            "system_id": "bcycle_lametro",
            "manifest_url": "https://gbfs.bcycle.com/bcycle_lametro/gbfs.json",
            "station_name_replacements": {
                "Santa Monica Expo Line": "SMC Expo Line",
                "Station": "Sta.",
                "North": "N.",
                "East": "E.",
                "South": "S.",
                "West": "W.",
                "Place": "Pla",
                "Center": "Ctr",
                "Pop-up Station": "Pop-up"
            }
        }
    ],
    "bots": [
        {
            "area_of_interest": {
                "center": {
                    "latitude": 34.0432071,
                    "longitude": -118.2849729
                },
                "radius": 10
            },
            "bike_share_system_ids": [
                "bcycle_lametro"
            ],
            "twitter": {
                "screen_name": "YourTwitterHandle",
                "consumer_key": "Consumer key",
                "consumer_secret": "Consumer secret",
                "access_token_key": "Access token key",
                "access_token_secret": "Access token secret"
            },
            "replies": {
                "challenge": {
                    "location_not_found": "I can't find {location}, so I don't know how to challenge you. Try tagging your reply with your location.",
                    "messages": [
                        "Go from {start} to {end} ({distance}, {duration}) {link}",
                        "Try {start} to {end} in {duration} ({distance}) {link}",
                        "How about {start} to {end}? ({distance}, {duration}) {link}",
                        "{start} to {end} in {duration}. You got this! ({distance}) {link}"
                    ]
                }
            }
        }
    ],
    "google_api_key": "Google API key with Places API enabled"
}

If running this program locally:

# assumes settings.json is located at /tmp/data
dotnet restore # Only necessary to run the first time
dotnet run -- /tmp/data/settings.json

If running the Docker image:

# assumes settings.json is located at /tmp/data
docker run -d -it -v /tmp/data:/data thzinc/bikesharesystem

Building

Docker Build Status

The Dockerfile is able to build the program and produce the Docker image. If working and running locally, you'll need .NET Core 2.0 installed.

Building the Docker image

The following builds a local Docker image named and tagged thzinc/bikesharesystem:devel

docker build -t thzinc/bikesharesystem:devel .
Building the program locally
dotnet restore
dotnet build

Code of Conduct

We are committed to fostering an open and welcoming environment. Please read our code of conduct before participating in or contributing to this project.

Contributing

We welcome contributions and collaboration on this project. Please read our contributor's guide to understand how best to work with us.

License and Authors

Daniel James logo Daniel James

license GitHub contributors

This software is made available by Daniel James under the MIT license.

Tag summary

Content type

Image

Digest

Size

180.2 MB

Last updated

almost 9 years ago

docker pull thzinc/bikesharesystem