mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-01 03:24:41 +01:00
62e3358a5b
This should allow us to differentiate the origin of the notification, and further prevent plugins from spoofing native notifications.
22 lines
453 B
Python
Executable File
22 lines
453 B
Python
Executable File
#!/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()
|