You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
5 years ago
|
import main
|
||
2 years ago
|
from modules import helpers
|
||
5 years ago
|
|
||
2 years ago
|
|
||
5 years ago
|
class ListCommand:
|
||
|
def __init__(self, *args):
|
||
|
self.list(*args)
|
||
|
|
||
2 years ago
|
def list(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
||
5 years ago
|
if authed:
|
||
4 years ago
|
if length == 1:
|
||
|
for i in main.network.keys():
|
||
2 years ago
|
first_relay = helpers.get_first_relay(i)
|
||
|
####
|
||
|
if not first_relay:
|
||
4 years ago
|
info("Network has no first instance: %s" % i)
|
||
|
continue
|
||
2 years ago
|
first_relay.list()
|
||
|
success(f"Requested list with instance {first_relay.num} of {i}")
|
||
4 years ago
|
return
|
||
|
elif length == 2:
|
||
5 years ago
|
if not spl[1] in main.network.keys():
|
||
|
failure("No such network: %s" % spl[1])
|
||
|
return
|
||
2 years ago
|
first_relay = helpers.get_first_relay(spl[1])
|
||
|
if not first_relay:
|
||
|
failure("Could not get first instance")
|
||
5 years ago
|
return
|
||
2 years ago
|
first_relay.list()
|
||
|
success(f"Requested list with instance {first_relay.num} of {spl[1]}")
|
||
5 years ago
|
return
|
||
|
else:
|
||
|
incUsage("list")
|
||
|
return
|
||
|
else:
|
||
|
incUsage(None)
|