mirror of
https://github.com/ElementsProject/lightning.git
synced 2026-08-13 12:32:55 +02:00
Changelog-Added: Plugins: "filters" can be specified on the `custommsg` hook to limit what message types the hook will be called for. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
16 lines
359 B
Python
Executable file
16 lines
359 B
Python
Executable file
#!/usr/bin/env python3
|
|
from pyln.client import Plugin
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
@plugin.hook('custommsg', filters=[0xaaff])
|
|
def on_custommsg(peer_id, payload, plugin, message=None, **kwargs):
|
|
plugin.log("Got custommessage_b {msg} from peer {peer_id}".format(
|
|
msg=payload,
|
|
peer_id=peer_id
|
|
))
|
|
return {'result': 'continue'}
|
|
|
|
|
|
plugin.run()
|