forked from mirrors/misskey
fix(backend): handle leave message
This commit is contained in:
@@ -56,6 +56,7 @@ class MahjongRoomChannel extends Channel {
|
|||||||
case 'ready': this.ready(body); break;
|
case 'ready': this.ready(body); break;
|
||||||
case 'updateSettings': this.updateSettings(body.key, body.value); break;
|
case 'updateSettings': this.updateSettings(body.key, body.value); break;
|
||||||
case 'addAi': this.addAi(); break;
|
case 'addAi': this.addAi(); break;
|
||||||
|
case 'leave': this.leaveRoom(); break;
|
||||||
case 'confirmNextKyoku': this.confirmNextKyoku(); break;
|
case 'confirmNextKyoku': this.confirmNextKyoku(); break;
|
||||||
case 'dahai': this.dahai(body.tile, body.riichi); break;
|
case 'dahai': this.dahai(body.tile, body.riichi); break;
|
||||||
case 'tsumoHora': this.tsumoHora(); break;
|
case 'tsumoHora': this.tsumoHora(); break;
|
||||||
@@ -98,6 +99,13 @@ class MahjongRoomChannel extends Channel {
|
|||||||
this.mahjongService.addAi(this.roomId!, this.user);
|
this.mahjongService.addAi(this.roomId!, this.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
private async leaveRoom() {
|
||||||
|
if (this.user == null) return;
|
||||||
|
|
||||||
|
this.mahjongService.leaveRoom(this.roomId!, this.user);
|
||||||
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async dahai(tile: number, riichi = false) {
|
private async dahai(tile: number, riichi = false) {
|
||||||
if (this.user == null) return;
|
if (this.user == null) return;
|
||||||
|
|||||||
@@ -358,6 +358,7 @@ export type Channels = {
|
|||||||
body: unknown;
|
body: unknown;
|
||||||
};
|
};
|
||||||
addAi: Record<string, never>;
|
addAi: Record<string, never>;
|
||||||
|
leave: Record<string, never>;
|
||||||
confirmNextKyoku: Record<string, never>;
|
confirmNextKyoku: Record<string, never>;
|
||||||
dahai: {
|
dahai: {
|
||||||
tile: number;
|
tile: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user