diff options
author | Stavros Korokithakis <hi@stavros.io> | 2018-12-10 04:57:03 +0200 |
---|---|---|
committer | Stavros Korokithakis <hi@stavros.io> | 2018-12-10 04:57:03 +0200 |
commit | 2bdce115eea41b00c31c64e47d388decc4766fe7 (patch) | |
tree | bb5c6c56a2aa39e183a17189596ecf8abe968468 /README.md | |
parent | 0aca0ae50a7336c705a92f2444d6fcd1b3e283e9 (diff) | |
download | pysignald-2bdce115eea41b00c31c64e47d388decc4766fe7.tar.gz pysignald-2bdce115eea41b00c31c64e47d388decc4766fe7.zip |
Add bot interface
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -39,6 +39,25 @@ for message in s.receive_messages(): print(message) ``` +You can also use the chat decorator interface: + +```python +from signald import Signal + +s = Signal("+1234567890") + +@s.chat_handler("hello") # This is case-insensitive. +def hello(message, match): + return "Hello there!" + + +@s.chat_handler(re.compile("my name is (.*)")) # This is case-sensitive. +def name(message, match): + return "Hello %s." % match.group(1) + + +s.run_chat() +``` Various ------- |