Code Monkey home page Code Monkey logo

peoples-bot's Introduction

People's Bot

This is a bot that has a hodgepodge of commands. This was originally a way to prove out some simple functionalities.

Commands

Below is a list of all the commands supported. For more details on each one, read the section below.

Note: All of the commands are prefixed using !.

Command Description
!help Shows all the commands available
!help <command> Shows the help option for that specific command.
!<vaccine-type> <zipcode> Example vaccine command.
!pfizer 60601 Find all pfizer vaccine appointments within 5 miles of 60601 (Illinois).
!moderna 90210 Find all moderna vaccine appointmens within 5 miles of 90210 (California).
!jj 11201 Find all johnson & johnson vaccines within 5 miles of 11201 (New York).
!beach Starts a beach (OTR) session in the current channel. Only one can be active per channel. If no one reacts to the bot message, the conversation will be saved.
!gh Returns a link to the commit that is currently deployed.

COVID-19 Vaccine Finder

It's really easy to find a COVID-19 vaccine using this bot. You can search for a specific vaccine near your zip code by using the guide below. Currently, the pfizer, moderna and jj (Johnson & Johnson) vaccines are searchable.

This mimics the backend of https://vaccines.gov to render appointments.

Beach Sand

An off-the-record-like command. When invoked, this command sends a message to the channel, initiating the session and reacts to that message with an ๐ŸŒŠ reaction.

Any conversation that is had after that bot message will be eligible to be deleted until someone reacts to the original bot message with the ๐ŸŒŠ reaction.

This command lasts for about 10 minutes.

Github

This command specifically returns a link to the latest deploy SHA.

Installing in your Discord server

TODO

Development

This repo uses Ruby 3 and leverages discordrb to create a bot.

Every pull request must have a passing test suite.

To run the specs:

bundle exec rspec

Deployment

This repo is set to automatically deploy to Heroku when a pull request is merged into main.

If you'd like to deploy this to your own personal Heroku instance, you will need the following environment variables:

  • DISCORD_BOT_CLIENT_TOKEN
  • DISCORD_BOT_CLIENT_ID
  • MAPBOX_TOKEN
  • VACCINE_API_URL
  • PROVIDER_URL

NOTE: Discordrb::Commands::CommandBot uses websockets to connect to Discord. When deploying to Heroku, make sure the application has worker dynos enabled so that the application does not shutdown.

Optional

When the bot is initializing, it uses the two following environment variables to set it's own status:

  • HEROKU_SLUG_COMMIT - the SHA of the deployed code
  • HEROKU_RELEASE_VERSION - the release version of the code

peoples-bot's People

Contributors

hectron avatar

Stargazers

 avatar

Watchers

 avatar

peoples-bot's Issues

Add debug information when no results

When no appointments are found, we currently don't display any helpful information.

This might be the result of a bad request, a backend issue or something else. Ideally, we can re-post the parameters that were specified and provide a link to the actual site.

Implement a lock for the beach command per channel.

When the beach command is invoked, there might be a chance that the command is currently active in the channel. We need to ensure that the command can only be invoked once per channel, while a sandy conversation is going on.

Delete original beach message after deleting

Right now, when the chat history is deleted, we do not delete the original message that the bot responds with. This allows the users to continue reacting, thus triggering the delete messages action.

We should delete the bot message when a reaction is done.

Beach sessions are lost during a deploy

When a beach session is awaiting a reaction, if a deploy goes out or the application is re-started, the await is killed and it is no longer monitored. This causes the original await to never be fulfilled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.