core-lightning/tests/plugins/custom_notifications.py

22 lines
453 B
Python
Raw Normal View History

#!/usr/bin/env python3
from pyln.client import Plugin
plugin = Plugin()
@plugin.subscribe("custom")
def on_custom_notification(origin, payload, **kwargs):
plugin.log("Got a custom notification {} from plugin {}".format(payload, origin))
@plugin.method("emit")
def emit(plugin):
"""Emit a simple string notification to topic "custom"
"""
plugin.notify("custom", "Hello world")
plugin.add_notification_topic("custom")
plugin.run()