2020-04-04 12:42:02 +02:00
|
|
|
export class Message {
|
|
|
|
userId: string;
|
2020-05-03 22:24:14 +02:00
|
|
|
name: string;
|
2020-05-08 15:18:22 +02:00
|
|
|
character: string;
|
2020-04-04 12:42:02 +02:00
|
|
|
|
2020-04-07 10:08:04 +02:00
|
|
|
constructor(data: any) {
|
2020-05-16 00:19:27 +02:00
|
|
|
if (!data.userId) {
|
2020-05-13 22:11:05 +02:00
|
|
|
console.error("Got invalid message", data);
|
2020-05-16 00:19:27 +02:00
|
|
|
throw Error("userId cannot be null");
|
2020-04-04 17:22:02 +02:00
|
|
|
}
|
2020-04-04 12:42:02 +02:00
|
|
|
this.userId = data.userId;
|
2020-05-03 22:24:14 +02:00
|
|
|
this.name = data.name;
|
2020-05-08 15:18:22 +02:00
|
|
|
this.character = data.character;
|
2020-04-04 12:42:02 +02:00
|
|
|
}
|
2020-05-08 15:18:22 +02:00
|
|
|
}
|