added top game handling

This commit is contained in:
2018-12-19 15:16:15 +01:00
parent ed3a3c5595
commit 0e70126c7a
3 changed files with 102 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
def find_channel_with_name(name: str, server, parent: int = None):
def find_create_channel(name: str, server, parent: int = None):
channels = server.getChannels()
for cid, channel in channels.items():
@@ -9,7 +9,8 @@ def find_channel_with_name(name: str, server, parent: int = None):
if channel.name == name:
return channel
return None
new_cid = server.addChannel(name, parent if parent else 0)
return server.getChannelState(new_cid)
def get_empty_channels(server, parent: int = None):
@@ -24,6 +25,17 @@ def get_empty_channels(server, parent: int = None):
return empty_channels
def get_subchannels(server, parent: int):
sub_channel = []
channels = server.getChannels()
for cid, channel in channels.items():
if channel.parent == parent:
sub_channel.append(channel)
return sub_channel
def get_user_for_channel(cid, server):
users = server.getUsers()
users_in_channel = {}