# gramhopper
[![image](https://img.shields.io/pypi/v/gramhopper.svg)](https://pypi.org/project/gramhopper/)
[![image](https://img.shields.io/pypi/l/gramhopper.svg)](https://pypi.org/project/gramhopper/)
[![image](https://img.shields.io/pypi/pyversions/gramhopper.svg)](https://pypi.org/project/gramhopper/)
A bot platform for automatic responses based on various triggers.
![](https://raw.githubusercontent.com/OrBin/gramhopper/master/demo.gif "Conversation example")
<details>
<summary>Click to view this demo's configuration</summary>
```yaml
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!
```
</details>
## Setup and Configuration
Follow [this tutorial](SETUP_AND_CONFIGURE.md) to setup a bot and configure gramhopper.
## Install and Run
To run gramhopper, just run:
#### From installed package
```bash
pip install gramhopper
gramhopper
```
##### Specify configuration file
```bash
gramhopper --config=/path/to/rules_file.yml
```
#### From docker image
```bash
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](https://gramhopper.readthedocs.io/en/latest/).
## Contributing
You are welcome to contribute to gramhopper - read the [contribution guidelines](CONTRIBUTING.md) to get started.
Raw data
{
"_id": null,
"home_page": "https://github.com/OrBin/gramhopper",
"name": "gramhopper",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "gramhopper telegram bot",
"author": "Or Bin, Meir Halachmi",
"author_email": "orbin50@gmail.com, meir.halachmi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/dc/d5/f185bcb0a62f810581f13ceea5a19c04f80efb1952bbd3a5dfd387c1666c/gramhopper-3.0.1.tar.gz",
"platform": null,
"description": "# gramhopper\n[![image](https://img.shields.io/pypi/v/gramhopper.svg)](https://pypi.org/project/gramhopper/)\n[![image](https://img.shields.io/pypi/l/gramhopper.svg)](https://pypi.org/project/gramhopper/)\n[![image](https://img.shields.io/pypi/pyversions/gramhopper.svg)](https://pypi.org/project/gramhopper/)\n\nA bot platform for automatic responses based on various triggers.\n\n![](https://raw.githubusercontent.com/OrBin/gramhopper/master/demo.gif \"Conversation example\")\n<details>\n <summary>Click to view this demo's configuration</summary>\n\n```yaml\ntriggers:\n - name: cat\n type: text.has_exact_word\n word:\n - Meow\n - meow\n - name: duck\n type: text.has_exact_word\n word: Quack\nresponses:\n - name: found_dog\n type: preset.reply\n preset_response:\n - Hey, here's a dog!\nrules:\n # Identifies a cat (a global \"cat\" trigger) and sends \"Hello cat!\" (an inline response).\n - trigger: cat\n response:\n type: preset.message\n preset_response: Hello cat!\n # Identifies a dog (an inline trigger) and replies \"Hey, here's a dog!\"\n # (a global \"found_dog\" response).\n - trigger:\n type: text.has_substring\n substring:\n - Woof\n - woof\n - Ruff\n - ruff\n response: found_dog\n # Identifies an animal sound (an inline trigger) and replies \n # 'I hear \"(the animal sound)\"' (an inline response), with a 30% probability.\n - trigger:\n type: text.regexp\n pattern: ^(Quack|Meow|Woof|Moo)$\n response:\n type: match.message\n template: I hear \"{0}\"\n probability: 0.3\n # Identifies 5 occurrences in 60 seconds of a duck sound (an inline event_streak\n # trigger that uses a global \"duck\" trigger\") and replies \"Shut up duck!\".\n - trigger:\n type: event_streak\n counting_event_trigger: duck\n streak_timeout_sec: 60\n event_count: 5\n response:\n type: preset.message\n preset_response: Shut up duck!\n```\n</details>\n\n## Setup and Configuration\nFollow [this tutorial](SETUP_AND_CONFIGURE.md) to setup a bot and configure gramhopper.\n\n## Install and Run\nTo run gramhopper, just run:\n#### From installed package\n\n```bash\npip install gramhopper\ngramhopper\n```\n\n##### Specify configuration file\n```bash\ngramhopper --config=/path/to/rules_file.yml\n```\n\n#### From docker image\n```bash\ndocker pull orbin/gramhopper:latest\ndocker run -it -v /your/configuration/dir:/root/.gramhopper orbin/gramhopper:latest\n```\n\n## Documentation\nRead more about the various triggers and responses in [our documentation](https://gramhopper.readthedocs.io/en/latest/).\n\n## Contributing\nYou are welcome to contribute to gramhopper - read the [contribution guidelines](CONTRIBUTING.md) to get started.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A bot platform for automatic responses based on various triggers",
"version": "3.0.1",
"split_keywords": [
"gramhopper",
"telegram",
"bot"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "472820f4b008fa827addab59234aad2a",
"sha256": "7815704418c08c1b368fccfce12810f0221c4d430c56312c01fcde3490815e2a"
},
"downloads": -1,
"filename": "gramhopper-3.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "472820f4b008fa827addab59234aad2a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 23903,
"upload_time": "2022-12-21T00:05:50",
"upload_time_iso_8601": "2022-12-21T00:05:50.352752Z",
"url": "https://files.pythonhosted.org/packages/e5/e5/35775926f97a816d761f1228668e7fb252a819fe675acbd14fab9646f694/gramhopper-3.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "1fecbe7af34f162f3319ed224dedf5a6",
"sha256": "9b8cbb507261e0eef80ff077ccf9913cb883d5f0adddd3470d57bf30243c0afd"
},
"downloads": -1,
"filename": "gramhopper-3.0.1.tar.gz",
"has_sig": false,
"md5_digest": "1fecbe7af34f162f3319ed224dedf5a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16314,
"upload_time": "2022-12-21T00:05:52",
"upload_time_iso_8601": "2022-12-21T00:05:52.813563Z",
"url": "https://files.pythonhosted.org/packages/dc/d5/f185bcb0a62f810581f13ceea5a19c04f80efb1952bbd3a5dfd387c1666c/gramhopper-3.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-21 00:05:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "OrBin",
"github_project": "gramhopper",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "python_telegram_bot",
"specs": [
[
"==",
"13.15"
]
]
},
{
"name": "boolean.py",
"specs": [
[
"==",
"3.6"
]
]
},
{
"name": "ruamel.yaml",
"specs": [
[
"~=",
"0.17"
]
]
},
{
"name": "sphinx",
"specs": [
[
"~=",
"5.3.0"
]
]
},
{
"name": "sphinx_rtd_theme",
"specs": [
[
"==",
"0.4.2"
]
]
},
{
"name": "flaky",
"specs": [
[
"~=",
"3.7.0"
]
]
},
{
"name": "invoke",
"specs": [
[
"~=",
"1.7.3"
]
]
},
{
"name": "pytype",
"specs": [
[
"~=",
"2022.12.15"
]
]
},
{
"name": "pylint",
"specs": [
[
"~=",
"2.15.9"
]
]
},
{
"name": "flake8",
"specs": [
[
"~=",
"6.0.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"~=",
"7.2.0"
]
]
},
{
"name": "wheel",
"specs": [
[
"==",
"0.37.1"
]
]
},
{
"name": "twine",
"specs": [
[
"~=",
"4.0.2"
]
]
}
],
"lcname": "gramhopper"
}