mirror of
https://github.com/aljazceru/python-teos.git
synced 2026-02-01 12:44:25 +01:00
plugin - improves listtowers output to resemble listpeers
This commit is contained in:
@@ -152,6 +152,15 @@ def get_appointment(plugin, tower_id, locator):
|
||||
return e.to_json()
|
||||
|
||||
|
||||
@plugin.method("listtowers", desc="List all towers registered towers.")
|
||||
def list_towers(plugin):
|
||||
towers_info = {"towers": []}
|
||||
for k, v in plugin.wt_client.towers.items():
|
||||
towers_info["towers"].append({"id": k, **v})
|
||||
|
||||
return towers_info
|
||||
|
||||
|
||||
@plugin.hook("commitment_revocation")
|
||||
def add_appointment(plugin, **kwargs):
|
||||
try:
|
||||
@@ -210,9 +219,4 @@ def add_appointment(plugin, **kwargs):
|
||||
return {"result": "continue"}
|
||||
|
||||
|
||||
@plugin.method("listtowers")
|
||||
def list_towers(plugin):
|
||||
return {k: v.to_dict() for k, v in plugin.wt_client.towers.items()}
|
||||
|
||||
|
||||
plugin.run()
|
||||
|
||||
Reference in New Issue
Block a user