A bot platform for automatic responses based on various triggers
Project description
gramhopper
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gramhopper-3.0.1.tar.gz.
File metadata
- Download URL: gramhopper-3.0.1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b8cbb507261e0eef80ff077ccf9913cb883d5f0adddd3470d57bf30243c0afd
|
|
| MD5 |
1fecbe7af34f162f3319ed224dedf5a6
|
|
| BLAKE2b-256 |
dcd5f185bcb0a62f810581f13ceea5a19c04f80efb1952bbd3a5dfd387c1666c
|
File details
Details for the file gramhopper-3.0.1-py3-none-any.whl.
File metadata
- Download URL: gramhopper-3.0.1-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7815704418c08c1b368fccfce12810f0221c4d430c56312c01fcde3490815e2a
|
|
| MD5 |
472820f4b008fa827addab59234aad2a
|
|
| BLAKE2b-256 |
e5e535775926f97a816d761f1228668e7fb252a819fe675acbd14fab9646f694
|