monolith/legacy/commands/dedup.py

28 lines
794 B
Python
Raw Normal View History

2022-08-27 10:19:28 +00:00
from json import dumps
2022-08-16 21:01:35 +00:00
import main
from modules import chankeep
2022-08-27 10:19:28 +00:00
2022-08-16 21:01:35 +00:00
class DedupCommand:
def __init__(self, *args):
self.dedup(*args)
2022-09-05 06:20:30 +00:00
def dedup(
self, addr, authed, data, obj, spl, success, failure, info, incUsage, length
):
2022-08-16 21:01:35 +00:00
if authed:
if length == 1:
dupes = chankeep.getDuplicateChannels()
chankeep.partChannels(dupes)
info(dumps(dupes))
return
elif length == 2:
if spl[1] not in main.network.keys():
failure("No such network: %s" % spl[1])
return
dupes = chankeep.getDuplicateChannels(spl[1])
chankeep.partChannels(dupes)
info(dumps(dupes))
return