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-2.1.0.tar.gz (15.4 kB view hashes)

Uploaded source

Built Distribution

gramhopper-2.1.0-py3-none-any.whl (24.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page