boca-chica-bot

module
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2021 License: MIT

README

🚀 boca-chica-bot

I am a Twitter and Discord Bot that posts status updates on beach and road closures related to SpaceX Starship testing in Boca Chica, TX.

twitter-badge
discord-invite-badge see Discord Installation below

go-version-badge go-report-card-badge pkg-go-dev-badge

How I Work

I periodically pull the published road and beach closures from the Cameron County SpaceX page to see if there are any changes or additions, then post status updates via Twitter and Discord as @BocaChicaBot.

Currently I will post a tweet/notification when:

  • A closure is added or changed
  • A closure has started or ended

I'm written in Go and run serverless in AWS using AWS Lambda, DynamoDB, and EventBridge.

arch diagram


Discord Installation

I am not a typical Discord Bot that responds to commands on demand. I only post notifications to the channels in the Discord server you add me to.

I will post to all channels in the server by default. This is likely not what you want, so be sure to disable the Send Messages permission for the BocaChicaBot Role in the channels/categories you'd like to disable me in.

discord-invite-badge


Deployment

Terraform Cloud is utilized for deploying my infrastructure. I have two workspaces (access required to see these):

Terraform Cloud Workspace Setup

Required Environment Variables for these workspaces in Terraform Cloud:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • TF_CLI_ARGS_plan=-var-file=workspaces/test.tfvars (for test)
  • TF_CLI_ARGS_plan=-var-file=workspaces/prod.tfvars (for prod)

Required Terraform Variables in Terraform Cloud:

  • twitter_consumer_key
  • twitter_consumer_secret
  • twitter_access_secret
  • twitter_access_token
  • discord_bot_token

These are used to populate the Parameter Store with the required Twitter and Discord API creds.

Local Development

Create a .env file with these env vars set:

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=us-east-1
DEBUG=true
DISABLE_PUBLISH=true
TWITTER_ENVIRONMENT=test

The .env file is leveraged in the lambci/lambda:go1.x Docker container used to run the lambda handler locally:

make run

Reference

Directories

Path Synopsis
cmd
internal
db
pkg
closures
Package closures retrieves beach and road closures related to SpaceX Starship testing in Boca Chica, TX.
Package closures retrieves beach and road closures related to SpaceX Starship testing in Boca Chica, TX.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL