Skip to main content

A bot platform for automatic responses based on various triggers

Project description

gramhopper

image image image

A bot platform for automatic responses based on various triggers.

Click to view this demo's configuration
triggers:
  - name: cat
    type: text.has_exact_word
    word:
      - Meow
      - meow
  - name: duck
    type: text.has_exact_word
    word: Quack
responses:
  - name: found_dog
    type: preset.reply
    preset_response:
      - Hey, here's a dog!
rules:
  # Identifies a cat (a global "cat" trigger) and sends "Hello cat!" (an inline response).
  - trigger: cat
    response:
      type: preset.message
      preset_response: Hello cat!
  # Identifies a dog (an inline trigger) and replies "Hey, here's a dog!"
  # (a global "found_dog" response).
  - trigger:
      type: text.has_substring
      substring:
        - Woof
        - woof
        - Ruff
        - ruff
    response: found_dog
  # Identifies an animal sound (an inline trigger) and replies 
  # 'I hear "(the animal sound)"' (an inline response), with a 30% probability.
  - trigger:
      type: text.regexp
      pattern: ^(Quack|Meow|Woof|Moo)$
    response:
      type: match.message
      template: I hear "{0}"
    probability: 0.3
  # Identifies 5 occurrences in 60 seconds of a duck sound (an inline event_streak
  # trigger that uses a global "duck" trigger") and replies "Shut up duck!".
  - trigger:
      type: event_streak
      counting_event_trigger: duck
      streak_timeout_sec: 60
      event_count: 5
    response:
      type: preset.message
      preset_response: Shut up duck!

Setup and Configuration

Follow this tutorial to setup a bot and configure gramhopper.

Install and Run

To run gramhopper, just run:

From installed package

pip install gramhopper
gramhopper
Specify configuration file
gramhopper --config=/path/to/rules_file.yml

From docker image

docker pull orbin/gramhopper:latest
docker run -it -v /your/configuration/dir:/root/.gramhopper orbin/gramhopper:latest

Documentation

Read more about the various triggers and responses in our documentation.

Contributing

You are welcome to contribute to gramhopper - read the contribution guidelines to get started.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gramhopper-3.0.1.tar.gz (16.3 kB view hashes)

Uploaded Source

Built Distribution

gramhopper-3.0.1-py3-none-any.whl (23.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page