95 lines
2.2 KiB
Python
95 lines
2.2 KiB
Python
from enum import IntEnum
|
|
|
|
class DraftMessage:
|
|
# Server
|
|
INFORM_PHASE_CHANGE = "inform.phase.change"
|
|
CONFIRM_PHASE_ADVANCE = "confirm.phase.advance"
|
|
INFORM_STATUS = "inform.status"
|
|
|
|
# Client
|
|
REQUEST_PHASE_ADVANCE = "request.phase.advance"
|
|
REQUEST_INFORM_STATUS = "request.inform.status"
|
|
|
|
# Waiting Phase
|
|
## Server
|
|
INFORM_JOIN_USER = "inform.join.user"
|
|
REQUEST_JOIN_PARTICIPANT = "request.join.participant"
|
|
REQUEST_JOIN_ADMIN = "request.join.admin"
|
|
|
|
## Client
|
|
NOTIFY_JOIN_USER = "notify.join.user"
|
|
CONFIRM_JOIN_PARTICIPANT = "confirm.join.participant"
|
|
CONFIRM_JOIN_ADMIN = "confirm.join.admin"
|
|
|
|
# Determine Order
|
|
## Server
|
|
CONFIRM_DETERMINE_DRAFT_ORDER = "confirm.determine.draft_order"
|
|
## Client
|
|
REQUEST_DETERMINE_DRAFT_ORDER = "request.determine.draft_order"
|
|
|
|
|
|
class DraftPhase(IntEnum):
|
|
WAITING = 0
|
|
DETERMINE_ORDER = 10
|
|
NOMINATION = 20
|
|
BIDDING = 30
|
|
AWARD = 40
|
|
FINALIZE = 50
|
|
|
|
def __str__(self):
|
|
return self.name.lower()
|
|
|
|
class DraftGroupChannelNames:
|
|
def __init__(self, id):
|
|
self.prefix = f"draft.{id}"
|
|
|
|
@property
|
|
def session(self):
|
|
return f"{self.prefix}.session"
|
|
|
|
@property
|
|
def admin(self):
|
|
return f"{self.prefix}.admin"
|
|
|
|
@property
|
|
def participant(self):
|
|
return f"{self.prefix}.participant"
|
|
|
|
class DraftCacheKeys:
|
|
def __init__(self, id):
|
|
self.prefix = f"draft:{id}"
|
|
|
|
@property
|
|
def admins(self):
|
|
return f"{self.prefix}:admins"
|
|
|
|
@property
|
|
def participants(self):
|
|
return f"{self.prefix}:participants"
|
|
|
|
|
|
# @property
|
|
# def state(self):
|
|
# return f"{self.prefix}:state"
|
|
|
|
# @property
|
|
# def current_movie(self):
|
|
# return f"{self.prefix}:current_movie"
|
|
|
|
# @property
|
|
# def bids(self):
|
|
# return f"{self.prefix}:bids"
|
|
|
|
# @property
|
|
# def participants(self):
|
|
# return f"{self.prefix}:participants"
|
|
|
|
# @property
|
|
# def bid_timer_end(self):
|
|
# return f"{self.prefix}:bid_timer_end"
|
|
|
|
# def user_status(self, user_id):
|
|
# return f"{self.prefix}:user:{user_id}:status"
|
|
|
|
# def user_channel(self, user_id):
|
|
# return f"{self.prefix}:user:{user_id}:channel" |