2020-04-01 14:23:22 +10:30
|
|
|
#!/usr/bin/env python3
|
|
|
|
"""
|
|
|
|
This plugin is used to test the `onion_message` hook.
|
|
|
|
"""
|
2020-06-22 13:29:10 -05:00
|
|
|
from pyln.client import Plugin
|
2020-04-01 14:23:22 +10:30
|
|
|
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
|
|
|
|
|
|
@plugin.hook("onion_message")
|
|
|
|
def on_onion_message(plugin, onion_message, **kwargs):
|
|
|
|
if 'reply_path' not in onion_message:
|
|
|
|
plugin.log("no reply path")
|
|
|
|
return
|
|
|
|
|
2021-09-21 14:53:45 +09:30
|
|
|
plugin.rpc.call('sendobsonionmessage', [onion_message['reply_path']])
|
2021-01-09 14:35:35 +10:30
|
|
|
plugin.log("Got onion_message invoice '{}'".format(onion_message['invoice']))
|
2020-04-01 14:23:22 +10:30
|
|
|
plugin.log("Sent reply via {}".format(onion_message['reply_path']))
|
|
|
|
return {"result": "continue"}
|
|
|
|
|
|
|
|
|
|
|
|
plugin.run()
|