Send error if room is full

This commit is contained in:
Ben 2020-02-14 21:58:00 +00:00
parent 08c97b24b1
commit 0d8c79c18d

View File

@ -26,6 +26,9 @@ class RoomMixin:
self.waddles = {} self.waddles = {}
async def add_penguin(self, p): async def add_penguin(self, p):
if len(self.penguins_by_id) >= self.max_users and not p.moderator:
return await p.send_error(210)
if p.room: if p.room:
await p.room.remove_penguin(p) await p.room.remove_penguin(p)
self.penguins_by_id[p.id] = p self.penguins_by_id[p.id] = p