GithubHelp home page GithubHelp logo

blueskeptical / acrobot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from m-czernek/acrobot

0.0 1.0 0.0 349 KB

A simple acronym bot for Google Chat

License: Apache License 2.0

Java 11.70% Python 0.35% HTML 86.40% CSS 1.54%

acrobot's Introduction

Acrobot

Build Status

Acrobot is a Google Hangouts chat bot, with the aim of keeping track of acronyms used within the company.

Image of Acrobot saving and answering an acronym

Image of Acrobot editing and removing acronym explanations

Usage

Acrobot is capable of multiple actions:

  • Saving an acronym: !acronym = explanation
  • Getting an acronym explanation: acronym
  • Modifying an acronym explanation: !acronym = explanation => new explanation
  • Removing an acronym explanation: !acronym = explanation =>

White spaces do not matter. If you are interacting with acrobot in a room, do not forget to tag the bot, e.g. @Acrobot !acronym = explanation.

You can change and remove only those explanations that you entered into the database.

Architecture

Acrobot is a simple application, using:

  • Java (tested against OpenJDK 11)
  • Hibernate
  • MySQL
  • Kubernetes/OpenShift for deployment #todo OCP template

This particular implementation uses Google's Cloud Pub/Sub messaging middleware.

Alt text

custom_mark10 @startuml; actor "Google Hangouts" as User; participant "Pub/Sub middleware" as A; participant Acrobot; User -> A: Send a message; Acrobot --> A: Poll for a message; Acrobot --> User: Send a response; @enduml; custom_mark10

As such, before deploying the Google bot, you have to complete Google's Pub/Sub prerequisites:

  1. Create a project in the Cloud Platform Console, which:
    1. Has the Pub/Sub API enabled.
    2. Has granted the Pub/Sub permissions to the [email protected] service role.
  2. Create a service account with the Pub/Sub API roles.
  3. Create a message queue in the Cloud Platform Console.
  4. Associate the queue with a subscription in the Cloud Platform Console.

For more details on setting up the bot, see the Google Developer's documentation.

Acrobot has a few dependencies:

  1. export GOOGLE_APPLICATION_CREDENTIALS: an environment variable that contains the path to the service account json you created. If you are deploying Acrobot on Kubernetes/OpenShift, you will have to inject the file either using a secret, or a config map, into your pod.
  2. export JDBC_URL, JDBC_USER, and JDBC_PASSWORD for the DB connection details.
  3. export PROJECT_ID and SUBSCRIPTION_ID which match your Google project and subscription created earlier.

Testing

Acrobot contains unit tests with an in-memory H2 database. You should execute all tests before pushing new code. You can execute tests by issuing: mvn clean test. To execute a particular test, you can specify the test parameter in the format of ClassName#TestName, for example:

mvn clean test -Dtest=MessageHelperTest#exceptionPropagationTest

All new features should have tests.

Credits

Author: Marek Czernek. The idea of Acrobot came from a number of very smart folks at Red Hat. The IRC implementation was done by https://github.com/mfojtik. If you wish to run AcroBot on IRC, see the AcroBot Implementation.

acrobot's People

Contributors

dependabot[bot] avatar blueskeptical avatar adamochayon avatar

Watchers

James Cloos avatar

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.