def execute_command(self, sender: User, cmd: str): if cmd == "LEAVE": self._clients.remove(sender) self.send_msg( "<server>", self._leave_msg.replace("<nick>", sender.get_nickname())) elif "RAW" in cmd: self._broadcast(cmd)
def add_client(self, usr_obj: User): if len(self._clients) < self._max_clients: self._clients.append(usr_obj) self.send_msg( "server", self._join_msg.replace("<nick>", usr_obj.get_nickname())) else: usr_obj.sock.send("FULL") self.send_msg( "server", f"{usr_obj.get_nickname()} tried to join, but the room is full!" )