2016-07-14 10:37:07 +00:00
|
|
|
from objects import glob
|
|
|
|
|
2016-09-02 15:45:10 +00:00
|
|
|
class channel:
|
2016-08-17 14:41:05 +00:00
|
|
|
def __init__(self, name, description, publicRead, publicWrite, temp, hidden):
|
2016-04-19 17:40:59 +00:00
|
|
|
"""
|
|
|
|
Create a new chat channel object
|
|
|
|
|
2016-11-17 18:13:06 +00:00
|
|
|
:param name: channel name
|
|
|
|
:param description: channel description
|
|
|
|
:param publicRead: if True, this channel can be read by everyone. If False, it can be read only by mods/admins
|
|
|
|
:param publicWrite: same as public read, but regards writing permissions
|
|
|
|
:param temp: if True, this channel will be deleted when there's no one in this channel
|
|
|
|
:param hidden: if True, thic channel won't be shown in channels list
|
2016-04-19 17:40:59 +00:00
|
|
|
"""
|
2016-08-17 14:41:05 +00:00
|
|
|
self.name = name
|
|
|
|
self.description = description
|
|
|
|
self.publicRead = publicRead
|
|
|
|
self.publicWrite = publicWrite
|
2016-07-14 10:37:07 +00:00
|
|
|
self.moderated = False
|
|
|
|
self.temp = temp
|
2016-07-15 09:46:44 +00:00
|
|
|
self.hidden = hidden
|
2016-07-14 10:37:07 +00:00
|
|
|
|
2016-12-11 10:07:35 +00:00
|
|
|
# Make Foka join the channel
|
|
|
|
fokaToken = glob.tokens.getTokenFromUserID(999)
|
|
|
|
if fokaToken is not None:
|
2018-08-04 17:16:40 +00:00
|
|
|
fokaToken.joinChannel(self)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def isSpecial(self):
|
|
|
|
return any(self.name.startswith(x) for x in ("#spect_", "#multi_"))
|
|
|
|
|
|
|
|
@property
|
|
|
|
def clientName(self):
|
|
|
|
if self.name.startswith("#spect_"):
|
|
|
|
return "#spectator"
|
|
|
|
elif self.name.startswith("#multi_"):
|
|
|
|
return "#multiplayer"
|
|
|
|
return self.name
|