Implement users command to see the mutual users of one or more channels and squash some bugs

This commit is contained in:
2018-10-08 20:08:10 +01:00
parent a98ed4e4d0
commit 44aa0f1727
4 changed files with 50 additions and 6 deletions

View File

@@ -16,17 +16,32 @@ def getWho(query):
result[i] = f
return result
def getChansSingle(name, query):
query = ["live.chan."+name+"."+i for i in query]
result = main.r.sinter(*query)
def getChansSingle(name, nick):
nick = ["live.chan."+name+"."+i for i in nick]
result = main.r.sinter(*nick)
if len(result) == 0:
return None
return [i.decode() for i in result]
def getChans(query):
def getChans(nick):
result = {}
for i in main.pool.keys():
f = getChansSingle(i, query)
f = getChansSingle(i, nick)
if f:
result[i] = f
return result
def getUsersSingle(name, nick):
nick = ["live.who."+name+"."+i for i in nick]
result = main.r.sinter(*nick)
if len(result) == 0:
return None
return [i.decode() for i in result]
def getUsers(nick):
result = {}
for i in main.pool.keys():
f = getUsersSingle(i, nick)
if f:
result[i] = f
return result