adding python example
This commit is contained in:
parent
fb53a11879
commit
b3ff3b0e69
21
README.md
21
README.md
|
@ -83,3 +83,24 @@ Send a message:
|
|||
```sh
|
||||
$ signal-cli --dbus-system send -m "hey test" <RECIPIENT>
|
||||
```
|
||||
## Receive messages from signal-cli daemon
|
||||
|
||||
The signal-cli daemon publishes new messages to dbus.
|
||||
Here's an example using python:
|
||||
```python
|
||||
def msgRcv (timestamp, source, groupID, message, attachments):
|
||||
print ("Message", message, "received in group", signal.getGroupName (groupID))
|
||||
return
|
||||
|
||||
from pydbus import SystemBus
|
||||
from gi.repository import GLib
|
||||
|
||||
bus = SystemBus()
|
||||
loop = GLib.MainLoop()
|
||||
|
||||
signal = bus.get('org.asamk.Signal')
|
||||
|
||||
```
|
||||
|
||||
signal.onMessageReceived = msgRcv
|
||||
loop.run()
|
||||
|
|
Loading…
Reference in a new issue